'."\n";
my $upload=&mt("Upload Scores");
my $upfile_select=&Apache::loncommon::upfile_select_html();
my $ignore=&mt('Ignore First Line');
@@ -4414,7 +4115,7 @@ ENDPICK
}
# FIXME do a check for any duplicated user ids...
# FIXME do a check for any invalid user ids?...
- $request->print('
+ $request->print('
'."\n");
$request->print(&show_grading_menu_form($symb));
return '';
@@ -4451,7 +4152,6 @@ sub csvuploadassign {
my ($classlist) = &getclasslist('all',0);
my @notallowed;
my @skipped;
- my @warnings;
my $countdone=0;
foreach my $grade (@gradedata) {
my %entries=&Apache::loncommon::record_sep($grade);
@@ -4500,9 +4200,6 @@ sub csvuploadassign {
my $pcr=$entries{$fields{$dest}} / $wgt;
my $award=($pcr == 0) ? 'incorrect_by_override'
: 'correct_by_override';
- if ($pcr>1) {
- push(@warnings,&mt("[_1]: point value larger than weight","$username:$domain"));
- }
$grades{"resource.$part.awarded"}=$pcr;
$grades{"resource.$part.solved"}=$award;
$points{$part}=1;
@@ -4531,11 +4228,6 @@ sub csvuploadassign {
$domain,$username);
if ($result eq 'ok') {
$request->print('.');
-# Remove from grading queue
- &Apache::bridgetask::remove_from_queue('gradingqueue',$symb,
- $env{'course.'.$env{'request.course.id'}.'.domain'},
- $env{'course.'.$env{'request.course.id'}.'.num'},
- $domain,$username);
} else {
$request->print("".
&mt("Failed to save data for student [_1]. Message when trying to save was: [_2]",
@@ -4546,10 +4238,6 @@ sub csvuploadassign {
}
}
$request->print(' '.&Apache::lonhtmlcommon::confirm_success(&mt("Saved scores for [quant,_1,student]",$countdone),$countdone==0));
- if (@warnings) {
- $request->print(' '.&Apache::lonhtmlcommon::confirm_success(&mt('Warnings generated for the following saved scores:'),1).' ');
- $request->print(join(', ',@warnings));
- }
if (@skipped) {
$request->print(' '.&Apache::lonhtmlcommon::confirm_success(&mt('No scores stored for the following username(s):'),1).' ');
$request->print(join(', ',@skipped));
@@ -4573,8 +4261,7 @@ sub pickStudentPage {
my ($request) = shift;
my $alertmsg = &mt('Please select the student you wish to grade.');
- $request->print(<
+ $request->print(&Apache::lonhtmlcommon::scripttag(<
LISTJAVASCRIPT
&commonJSfunctions($request);
my ($symb) = &get_symb($request);
@@ -4822,8 +4508,8 @@ sub displayPage {
&Apache::loncommon::start_data_table_row().
''.$prob.
(scalar(@{$parts}) == 1 ? ''
- : ' ('.&mt('[_1]parts',
- scalar(@{$parts}).' ').')'
+ : ' ('.&mt('[_1] parts)',
+ scalar(@{$parts}))
).
' ';
$studentTable.='';
@@ -4905,7 +4591,6 @@ sub displaySubByDates {
&Apache::loncommon::start_data_table_header_row().
' '.&mt('Date/Time').' '.
($isCODE?''.&mt('CODE').' ':'').
- ($isTask?''.&mt('Version').' ':'').
''.&mt('Submission').' '.
''.&mt('Status').' '.
&Apache::loncommon::end_data_table_header_row();
@@ -4919,16 +4604,13 @@ sub displaySubByDates {
my $interaction;
my $no_increment = 1;
- my %lastrndseed;
for ($version=1;$version<=$$record{'version'};$version++) {
my $timestamp =
&Apache::lonlocal::locallocaltime($$record{$version.':timestamp'});
if (exists($$record{$version.':resource.0.version'})) {
$interaction = $$record{$version.':resource.0.version'};
}
- if ($isTask && $env{'form.previousversion'}) {
- next unless ($interaction == $env{'form.previousversion'});
- }
+
my $where = ($isTask ? "$version:resource.$interaction"
: "$version:resource");
$studentTable.=&Apache::loncommon::start_data_table_row().
@@ -4936,15 +4618,12 @@ sub displaySubByDates {
if ($isCODE) {
$studentTable.=''.$record->{$version.':resource.CODE'}.' ';
}
- if ($isTask) {
- $studentTable.=''.$interaction.' ';
- }
my @versionKeys = split(/\:/,$$record{$version.':keys'});
my @displaySub = ();
foreach my $partid (@{$parts}) {
- my ($hidden,$type);
- $type = $$record{$version.':resource.'.$partid.'.type'};
- if (($type eq 'anonsurvey') || ($type eq 'anonsurveycred')) {
+ my $hidden;
+ if (($$record{$version.':resource.'.$partid.'.type'} eq 'anonsurvey') ||
+ ($$record{$version.':resource.'.$partid.'.type'} eq 'anonsurveycred')) {
$hidden = 1;
}
my @matchKey = ($isTask ? sort(grep /^resource\.\d+\.\Q$partid\E\.award$/,@versionKeys)
@@ -4958,42 +4637,32 @@ sub displaySubByDates {
my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/)
: ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/));
- $displaySub[0].='';
+ $displaySub[0].=''.&mt('Part: [_1]',$display_part).''
.' '
- .'('.&mt('Response ID: [_1]',$responseId).')'
+ .'('.&mt('Part ID: [_1]',$responseId).')'
.' '
.' ';
if ($hidden) {
$displaySub[0].= &mt('Anonymous Survey').' ';
} else {
- my ($trial,$rndseed,$newvariation);
- if ($type eq 'randomizetry') {
- $trial = $$record{"$where.$partid.tries"};
- $rndseed = $$record{"$where.$partid.rndseed"};
- }
if ($$record{"$where.$partid.tries"} eq '') {
$displaySub[0].=&mt('Trial not counted');
} else {
$displaySub[0].=&mt('Trial: [_1]',
$$record{"$where.$partid.tries"});
- if ($rndseed || $lastrndseed{$partid}) {
- if ($rndseed ne $lastrndseed{$partid}) {
- $newvariation = ' ('.&mt('New variation this try').')';
- }
- }
}
my $responseType=($isTask ? 'Task'
: $responseType->{$partid}->{$responseId});
if (!exists($orders{$partid})) { $orders{$partid}={}; }
- if ((!exists($orders{$partid}->{$responseId})) || ($trial)) {
+ if (!exists($orders{$partid}->{$responseId})) {
$orders{$partid}->{$responseId}=
&get_order($partid,$responseId,$symb,$uname,$udom,
- $no_increment,$type,$trial,$rndseed);
+ $no_increment);
}
- $displaySub[0].=''.$newvariation.' '; # /nobreak
+ $displaySub[0].=' '; # /nobreak
$displaySub[0].=' '.
- &cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom,$type,$trial,$rndseed).' ';
+ &cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom).' ';
}
}
}
@@ -5095,7 +4764,7 @@ sub updateGradeByPage {
&Apache::loncommon::start_data_table_row().
''.$prob.
(scalar(@{$parts}) == 1 ? ''
- : ' ('.&mt('[quant,_1,part]',scalar(@{$parts}))
+ : ' ('.&mt('[quant,_1, part]',scalar(@{$parts}))
.')').' ';
$studentTable.=' '.$title.' ';
@@ -5218,19 +4887,19 @@ sub updateGradeByPage {
from the file that we are parsing that represents one entire sheet
'bubble line' refers to the data
- representing the line of bubbles that are on the physical bubblesheet
+ representing the line of bubbles that are on the physical bubble sheet
-The overall process is that a scanned in bubblesheet data is uploaded
+The overall process is that a scanned in bubble sheet data is uploaded
into a course. When a user wants to grade, they select a
-sequence/folder of resources, a file of bubblesheet info, and pick
+sequence/folder of resources, a file of bubble sheet info, and pick
one of the predefined configurations for what each scanline looks
like.
Next each scanline is checked for any errors of either 'missing
bubbles' (it's an error because it may have been mis-scanned
because too light bubbling), 'double bubble' (each bubble line should
-have no more than one letter picked), invalid or duplicated CODE,
+have no more that one letter picked), invalid or duplicated CODE,
invalid student/employee ID
If the CODE option is used that determines the randomization of the
@@ -5239,14 +4908,14 @@ username:domain.
During the validation phase the instructor can choose to skip scanlines.
-After the validation phase, there are now 3 bubblesheet files
+After the validation phase, there are now 3 bubble sheet files
scantron_original_filename (unmodified original file)
scantron_corrected_filename (file where the corrected information has replaced the original information)
scantron_skipped_filename (contains the exact text of scanlines that where skipped)
Also there is a separate hash nohist_scantrondata that contains extra
-correction information that isn't representable in the bubblesheet
+correction information that isn't representable in the bubble sheet
file (see &scantron_getfile() for more information)
After all scanlines are either valid, marked as valid or skipped, then
@@ -5320,11 +4989,6 @@ my %subdivided_bubble_lines; # no.
my %responsetype_per_response; # responsetype for each response
-my %masterseq_id_responsenum; # src_id (e.g., 12.3_0.11 etc.) for each
- # numbered response. Needed when randomorder
- # or randompick are in use. Key is ID, value
- # is response number.
-
# Save and restore the bubble lines array to the form env.
@@ -5338,17 +5002,12 @@ sub save_bubble_lines {
$env{"form.scantron.responsetype.$line"} =
$responsetype_per_response{$line};
}
- foreach my $resid (keys(%masterseq_id_responsenum)) {
- my $line = $masterseq_id_responsenum{$resid};
- $env{"form.scantron.residpart.$line"} = $resid;
- }
}
sub restore_bubble_lines {
my $line = 0;
%bubble_lines_per_response = ();
- %masterseq_id_responsenum = ();
while ($env{"form.scantron.bubblelines.$line"}) {
my $value = $env{"form.scantron.bubblelines.$line"};
$bubble_lines_per_response{$line} = $value;
@@ -5358,12 +5017,28 @@ sub restore_bubble_lines {
$env{"form.scantron.sub_bubblelines.$line"};
$responsetype_per_response{$line} =
$env{"form.scantron.responsetype.$line"};
- my $id = $env{"form.scantron.residpart.$line"};
- $masterseq_id_responsenum{$id} = $line;
$line++;
}
}
+# Given the parsed scanline, get the response for
+# 'answer' number n:
+
+sub get_response_bubbles {
+ my ($parsed_line, $response) = @_;
+
+ my $bubble_line = $first_bubble_line{$response-1} +1;
+ my $bubble_lines= $bubble_lines_per_response{$response-1};
+
+ my $selected = "";
+
+ for (my $bline = 0; $bline < $bubble_lines; $bline++) {
+ $selected .= $$parsed_line{"scantron.$bubble_line.answer"}.":";
+ $bubble_line++;
+ }
+ return $selected;
+}
+
=pod
=item scantron_filenames
@@ -5376,16 +5051,14 @@ sub scantron_filenames {
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'};
my $cname=$env{'course.'.$env{'request.course.id'}.'.num'};
my $getpropath = 1;
- my ($dirlist,$listerror) = &Apache::lonnet::dirlist('userfiles',$cdom,
- $cname,$getpropath);
+ my @files=&Apache::lonnet::dirlist('userfiles',$cdom,$cname,
+ $getpropath);
my @possiblenames;
- if (ref($dirlist) eq 'ARRAY') {
- foreach my $filename (sort(@{$dirlist})) {
- ($filename)=split(/&/,$filename);
- if ($filename!~/^scantron_orig_/) { next ; }
- $filename=~s/^scantron_orig_//;
- push(@possiblenames,$filename);
- }
+ foreach my $filename (sort(@files)) {
+ ($filename)=split(/&/,$filename);
+ if ($filename!~/^scantron_orig_/) { next ; }
+ $filename=~s/^scantron_orig_//;
+ push(@possiblenames,$filename);
}
return @possiblenames;
}
@@ -5539,7 +5212,7 @@ sub scantron_CODEunique {
=item scantron_selectphase
- Generates the initial screen to start the bubblesheet process.
+ Generates the initial screen to start the bubble sheet process.
Allows for - starting a grading run.
- downloading existing scan data (original, corrected
or skipped info)
@@ -5572,54 +5245,6 @@ sub scantron_selectphase {
$ssi_error = 0;
- if (&Apache::lonnet::allowed('usc',$env{'request.role.domain'}) ||
- &Apache::lonnet::allowed('usc',$env{'request.course.id'})) {
-
- # Chunk of form to prompt for a scantron file upload.
-
- $r->print('
-
- '.&Apache::loncommon::start_data_table('LC_scantron_action').'
- '.&Apache::loncommon::start_data_table_header_row().'
-
- '.&mt('Specify a bubblesheet data file to upload.').'
-
- '.&Apache::loncommon::end_data_table_header_row().'
- '.&Apache::loncommon::start_data_table_row().'
-
-');
- my $default_form_data=&defaultFormData(&get_symb($r,1));
- my $cdom= $env{'course.'.$env{'request.course.id'}.'.domain'};
- my $cnum= $env{'course.'.$env{'request.course.id'}.'.num'};
- $r->print('
-
-
-
-');
-
- $r->print('
-
- '.&Apache::loncommon::end_data_table_row().'
- '.&Apache::loncommon::end_data_table().'
-');
- }
-
# Chunk of form to prompt for a file to grade and how:
$result.= '
@@ -5667,6 +5292,52 @@ sub scantron_selectphase {
$r->print($result);
+ if (&Apache::lonnet::allowed('usc',$env{'request.role.domain'}) ||
+ &Apache::lonnet::allowed('usc',$env{'request.course.id'})) {
+
+ # Chunk of form to prompt for a scantron file upload.
+
+ $r->print('
+
+ '.&Apache::loncommon::start_data_table('LC_scantron_action').'
+ '.&Apache::loncommon::start_data_table_header_row().'
+
+ '.&mt('Specify a bubblesheet data file to upload.').'
+
+ '.&Apache::loncommon::end_data_table_header_row().'
+ '.&Apache::loncommon::start_data_table_row().'
+
+');
+ my $default_form_data=&defaultFormData(&get_symb($r,1));
+ my $cdom= $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum= $env{'course.'.$env{'request.course.id'}.'.num'};
+ $r->print(&Apache::lonhtmlcommon::scripttag('
+ function checkUpload(formname) {
+ if (formname.upfile.value == "") {
+ alert("'.&mt('Please use the browse button to select a file from your local directory.').'");
+ return false;
+ }
+ formname.submit();
+ }'));
+ $r->print('
+
+');
+
+ $r->print('
+
+ '.&Apache::loncommon::end_data_table_row().'
+ '.&Apache::loncommon::end_data_table().'
+');
+ }
+
# Chunk of the form that prompts to view a scoring office file,
# corrected file, skipped records in a file.
@@ -5693,7 +5364,7 @@ sub scantron_selectphase {
&Apache::lonpickcode::code_list($r,2);
- $r->print('
\n");
+ }
+ my $message="".&mt("The ID on the form is [_1] ".
+ "The name on the paper is [_2],[_3]",
+ $$scan_record{'scantron.ID'},
+ $$scan_record{'scantron.LastName'},
+ $$scan_record{'scantron.FirstName'})."
";
$r->print(' '."\n");
$r->print(' '."\n");
@@ -7428,10 +6947,10 @@ sub scantron_get_correction {
if ($error =~ /ID$/) {
if ($error eq 'incorrectID') {
- $r->print(''.&mt("The encoded ID is not in the classlist").
+ $r->print("
".&mt("The encoded ID is not in the classlist").
"
\n");
} elsif ($error eq 'duplicateID') {
- $r->print(''.&mt("The encoded ID has also been used by a previous paper [_1]",$arg)."
\n");
+ $r->print("".&mt("The encoded ID has also been used by a previous paper [_1]",$arg)."
\n");
}
$r->print($message);
$r->print("".&mt("How should I handle this?")." \n");
@@ -7441,21 +6960,20 @@ sub scantron_get_correction {
$r->print(&Apache::loncommon::selectstudent_link('scantronupload',
'scantron_username','scantron_domain'));
$r->print(": ");
- $r->print("\n:\n".
+ $r->print("\n@".
&Apache::loncommon::select_dom_form($env{'request.role.domain'},'scantron_domain'));
$r->print('');
} elsif ($error =~ /CODE$/) {
if ($error eq 'incorrectCODE') {
- $r->print('
'.&mt("The encoded CODE is not in the list of possible CODEs.")."
\n");
+ $r->print("".&mt("The encoded CODE is not in the list of possible CODEs.")."
\n");
} elsif ($error eq 'duplicateCODE') {
- $r->print(''.&mt("The encoded CODE has also been used by a previous paper [_1], and CODEs are supposed to be unique.",join(', ',@{$arg}))."
\n");
+ $r->print("".&mt("The encoded CODE has also been used by a previous paper [_1], and CODEs are supposed to be unique.",join(', ',@{$arg}))."
\n");
}
- $r->print("".&mt('The CODE on the form is [_1]',
- "'$$scan_record{'scantron.CODE'}' ")
- ."
\n");
+ $r->print("".&mt("The CODE on the form is '[_1]' ",
+ $$scan_record{'scantron.CODE'})." \n");
$r->print($message);
- $r->print("
".&mt("How should I handle this?")."
\n");
+ $r->print("".&mt("How should I handle this?")." \n");
$r->print("\n ");
my $i=0;
if ($error eq 'incorrectCODE'
@@ -7482,14 +7000,13 @@ sub scantron_get_correction {
$r->print("
- ".&mt("Use the CODE [_1] that was on the paper, ignoring the error.",
+ ".&mt("Use the CODE [_1] that is was on the paper, ignoring the error.",
"".$$scan_record{'scantron.CODE'}." ")."
");
$r->print("\n ");
}
- $r->print(<
+ $r->print(&Apache::lonhtmlcommon::scripttag(<
ENDSCRIPT
my $href="/adm/pickcode?".
"form=".&escape("scantronupload").
@@ -7522,13 +7038,12 @@ ENDSCRIPT
" "));
$r->print("\n ");
} elsif ($error eq 'doublebubble') {
- $r->print(''.&mt("There have been multiple bubbles scanned for some question(s)")."
\n");
+ $r->print("".&mt("There have been multiple bubbles scanned for some question(s)")."
\n");
# The form field scantron_questions is acutally a list of line numbers.
# represented by this form so:
- my $line_list = &questions_to_line_list($arg,$randomorder,$randompick,
- $respnumlookup,$startline);
+ my $line_list = &questions_to_line_list($arg);
$r->print(' ');
@@ -7536,14 +7051,12 @@ ENDSCRIPT
$r->print("".&mt("Please indicate which bubble should be used for grading")."
");
foreach my $question (@{$arg}) {
my @linenums = &prompt_for_corrections($r,$question,$scan_config,
- $scan_record, $error,
- $randomorder,$randompick,
- $respnumlookup,$startline);
+ $scan_record, $error);
push(@lines_to_correct,@linenums);
}
$r->print(&verify_bubbles_checked(@lines_to_correct));
} elsif ($error eq 'missingbubble') {
- $r->print(''.&mt("There have been [_1]no[_2] bubbles scanned for some question(s)",'',' ')."
\n");
+ $r->print("".&mt("There have been no bubbles scanned for some question(s)")."
\n");
$r->print($message);
$r->print("".&mt("Please indicate which bubble should be used for grading.")."
");
$r->print(&mt("Some questions have no scanned bubbles.")."\n");
@@ -7552,16 +7065,13 @@ ENDSCRIPT
# a list of question numbers. Therefore:
#
- my $line_list = &questions_to_line_list($arg,$randomorder,$randompick,
- $respnumlookup,$startline);
+ my $line_list = &questions_to_line_list($arg);
$r->print(' ');
foreach my $question (@{$arg}) {
my @linenums = &prompt_for_corrections($r,$question,$scan_config,
- $scan_record, $error,
- $randomorder,$randompick,
- $respnumlookup,$startline);
+ $scan_record, $error);
push(@lines_to_correct,@linenums);
}
$r->print(&verify_bubbles_checked(@lines_to_correct));
@@ -7575,8 +7085,7 @@ sub verify_bubbles_checked {
my (@ansnums) = @_;
my $ansnumstr = join('","',@ansnums);
my $warning = &mt("A bubble or 'No bubble' selection has not been made for one or more lines.");
- my $output = (<
+ my $output = &Apache::lonhtmlcommon::scripttag((<
ENDSCRIPT
return $output;
}
@@ -7614,20 +7122,12 @@ used to fill in the scantron_questions f
Arguments:
questions - Reference to an array of questions.
- randomorder - True if randomorder in use.
- randompick - True if randompick in use.
- respnumlookup - Reference to HASH mapping question numbers in bubble lines
- for current line to question number used for same question
- in "Master Seqence" (as seen by Course Coordinator).
- startline - Reference to hash where key is question number (0 is first)
- and key is number of first bubble line for current student
- or code-based randompick and/or randomorder.
=cut
sub questions_to_line_list {
- my ($questions,$randomorder,$randompick,$respnumlookup,$startline) = @_;
+ my ($questions) = @_;
my @lines;
foreach my $item (@{$questions}) {
@@ -7636,16 +7136,8 @@ sub questions_to_line_list {
if ($item =~ /^(\d+)\.(\d+)$/) {
$question = $1;
my $subquestion = $2;
- my $responsenum = $question-1;
- if (($randomorder || $randompick) && (ref($respnumlookup) eq 'HASH')) {
- $responsenum = $respnumlookup->{$question-1};
- if (ref($startline) eq 'HASH') {
- $first = $startline->{$question-1} + 1;
- }
- } else {
- $first = $first_bubble_line{$responsenum} + 1;
- }
- my @subans = split(/,/,$subdivided_bubble_lines{$responsenum});
+ $first = $first_bubble_line{$question-1} + 1;
+ my @subans = split(/,/,$subdivided_bubble_lines{$question-1});
my $subcount = 1;
while ($subcount<$subquestion) {
$first += $subans[$subcount-1];
@@ -7653,16 +7145,8 @@ sub questions_to_line_list {
}
$count = $subans[$subquestion-1];
} else {
- my $responsenum = $question-1;
- if (($randomorder || $randompick) && (ref($respnumlookup) eq 'HASH')) {
- $responsenum = $respnumlookup->{$question-1};
- if (ref($startline) eq 'HASH') {
- $first = $startline->{$question-1} + 1;
- }
- } else {
- $first = $first_bubble_line{$responsenum} + 1;
- }
- $count = $bubble_lines_per_response{$responsenum};
+ $first = $first_bubble_line{$question-1} + 1;
+ $count = $bubble_lines_per_response{$question-1};
}
$last = $first+$count-1;
push(@lines, ($first..$last));
@@ -7684,14 +7168,6 @@ for multi and missing bubble cases).
$scan_config - The scantron file configuration hash.
$scan_record - Reference to the hash that has the the parsed scanlines.
$error - Type of error
- $randomorder - True if randomorder in use.
- $randompick - True if randompick in use.
- $respnumlookup - Reference to HASH mapping question numbers in bubble lines
- for current line to question number used for same question
- in "Master Seqence" (as seen by Course Coordinator).
- $startline - Reference to hash where key is question number (0 is first)
- and value is number of first bubble line for current student
- or code-based randompick and/or randomorder.
Implicit inputs:
%bubble_lines_per_response - Starting line numbers for each question.
@@ -7716,26 +7192,15 @@ for multi and missing bubble cases).
=cut
sub prompt_for_corrections {
- my ($r, $question, $scan_config, $scan_record, $error, $randomorder,
- $randompick, $respnumlookup, $startline) = @_;
+ my ($r, $question, $scan_config, $scan_record, $error) = @_;
my ($current_line,$lines);
my @linenums;
my $questionnum = $question;
- my ($first,$responsenum);
if ($question =~ /^(\d+)\.(\d+)$/) {
$question = $1;
+ $current_line = $first_bubble_line{$question-1} + 1 ;
my $subquestion = $2;
- if (($randomorder || $randompick) && (ref($respnumlookup) eq 'HASH')) {
- $responsenum = $respnumlookup->{$question-1};
- if (ref($startline) eq 'HASH') {
- $first = $startline->{$question-1};
- }
- } else {
- $responsenum = $question-1;
- $first = $first_bubble_line{$responsenum} + 1;
- }
- $current_line = $first + 1 ;
- my @subans = split(/,/,$subdivided_bubble_lines{$responsenum});
+ my @subans = split(/,/,$subdivided_bubble_lines{$question-1});
my $subcount = 1;
while ($subcount<$subquestion) {
$current_line += $subans[$subcount-1];
@@ -7743,34 +7208,25 @@ sub prompt_for_corrections {
}
$lines = $subans[$subquestion-1];
} else {
- if (($randomorder || $randompick) && (ref($respnumlookup) eq 'HASH')) {
- $responsenum = $respnumlookup->{$question-1};
- if (ref($startline) eq 'HASH') {
- $first = $startline->{$question-1};
- }
- } else {
- $responsenum = $question-1;
- $first = $first_bubble_line{$responsenum};
- }
- $current_line = $first + 1;
- $lines = $bubble_lines_per_response{$responsenum};
+ $current_line = $first_bubble_line{$question-1} + 1 ;
+ $lines = $bubble_lines_per_response{$question-1};
}
if ($lines > 1) {
$r->print(&mt('The group of bubble lines below responds to a single question.').' ');
- if (($responsetype_per_response{$responsenum} eq 'essayresponse') ||
- ($responsetype_per_response{$responsenum} eq 'formularesponse') ||
- ($responsetype_per_response{$responsenum} eq 'stringresponse') ||
- ($responsetype_per_response{$responsenum} eq 'imageresponse') ||
- ($responsetype_per_response{$responsenum} eq 'reactionresponse') ||
- ($responsetype_per_response{$responsenum} eq 'organicresponse')) {
- $r->print(&mt("Although this particular question type requires handgrading, the instructions for this question in the bubblesheet exam directed students to leave [quant,_1,line] blank on their bubblesheets.",$lines).' '.&mt('A non-zero score can be assigned to the student during bubblesheet grading by selecting a bubble in at least one line.').' '.&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.').' '.&mt("To assign a score of zero for this question, mark all lines as 'No bubble'.").' ');
+ if (($responsetype_per_response{$question-1} eq 'essayresponse') ||
+ ($responsetype_per_response{$question-1} eq 'formularesponse') ||
+ ($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 bubblesheets.",$lines).' '.&mt('A non-zero score can be assigned to the student during bubblesheet grading by selecting a bubble in at least one line.').' '.&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.').' '.&mt("To assign a score of zero for this question, mark all lines as 'No bubble'.").' ');
} else {
$r->print(&mt("Select at most one bubble in a single line and select 'No Bubble' in all the other lines. ")." ");
}
}
for (my $i =0; $i < $lines; $i++) {
my $selected = $$scan_record{"scantron.$current_line.answer"};
- &scantron_bubble_selector($r,$scan_config,$current_line,
+ &scantron_bubble_selector($r,$scan_config,$current_line,
$questionnum,$error,split('', $selected));
push(@linenums,$current_line);
$current_line++;
@@ -7803,19 +7259,7 @@ sub scantron_bubble_selector {
my $max=$$scan_config{'Qlength'};
my $scmode=$$scan_config{'Qon'};
- if ($scmode eq 'number' || $scmode eq 'letter') {
- if (($$scan_config{'BubblesPerRow'} =~ /^\d+$/) &&
- ($$scan_config{'BubblesPerRow'} > 0)) {
- $max=$$scan_config{'BubblesPerRow'};
- if (($scmode eq 'number') && ($max > 10)) {
- $max = 10;
- } elsif (($scmode eq 'letter') && $max > 26) {
- $max = 26;
- }
- } else {
- $max = 10;
- }
- }
+ if ($scmode eq 'number' || $scmode eq 'letter') { $max=10; }
my @alphabet=('A'..'Z');
$r->print(&Apache::loncommon::start_data_table().
@@ -7970,7 +7414,7 @@ sub scantron_validate_CODE {
my %allcodes=&get_codes();
my $nav_error;
- &scantron_get_maxbubble(\$nav_error,\%scantron_config); # parse needs the lines per response array.
+ &scantron_get_maxbubble(\$nav_error); # parse needs the lines per response array.
if ($nav_error) {
$r->print(&navmap_errormsg());
return(1,$currentphase);
@@ -8024,43 +7468,12 @@ sub scantron_validate_doublebubble {
#get student info
my $classlist=&Apache::loncoursedata::get_classlist();
my %idmap=&username_to_idmap($classlist);
- my (undef,undef,$sequence)=
- &Apache::lonnet::decode_symb($env{'form.selectpage'});
#get scantron line setup
my %scantron_config=&get_scantron_config($env{'form.scantron_format'});
my ($scanlines,$scan_data)=&scantron_getfile();
-
- my $navmap = Apache::lonnavmaps::navmap->new();
- unless (ref($navmap)) {
- $r->print(&navmap_errormsg());
- return(1,$currentphase);
- }
- my $map=$navmap->getResourceByUrl($sequence);
- my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
- my ($randomorder,$randompick,@master_seq,%symb_to_resource,%grader_partids_by_symb,
- %grader_randomlists_by_symb,%orderedforcode,%respnumlookup,%startline);
- my $bubbles_per_row = &bubblesheet_bubbles_per_row(\%scantron_config);
-
my $nav_error;
- if (ref($map)) {
- $randomorder = $map->randomorder();
- $randompick = $map->randompick();
- if ($randomorder || $randompick) {
- $nav_error = &get_master_seq(\@resources,\@master_seq,\%symb_to_resource);
- if ($nav_error) {
- $r->print(&navmap_errormsg());
- return(1,$currentphase);
- }
- &graders_resources_pass(\@resources,\%grader_partids_by_symb,
- \%grader_randomlists_by_symb,$bubbles_per_row);
- }
- } else {
- $r->print(&navmap_errormsg());
- return(1,$currentphase);
- }
-
- &scantron_get_maxbubble(\$nav_error,\%scantron_config); # parse needs the bubble line array.
+ &scantron_get_maxbubble(\$nav_error); # parse needs the bubble line array.
if ($nav_error) {
$r->print(&navmap_errormsg());
return(1,$currentphase);
@@ -8070,15 +7483,11 @@ sub scantron_validate_doublebubble {
my $line=&scantron_get_line($scanlines,$scan_data,$i);
if ($line=~/^[\s\cz]*$/) { next; }
my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config,
- $scan_data,undef,\%idmap,$randomorder,
- $randompick,$sequence,\@master_seq,
- \%symb_to_resource,\%grader_partids_by_symb,
- \%orderedforcode,\%respnumlookup,\%startline);
+ $scan_data);
if (!defined($$scan_record{'scantron.doubleerror'})) { next; }
&scantron_get_correction($r,$i,$scan_record,\%scantron_config,$line,
'doublebubble',
- $$scan_record{'scantron.doubleerror'},
- $randomorder,$randompick,\%respnumlookup,\%startline);
+ $$scan_record{'scantron.doubleerror'});
return (1,$currentphase);
}
return (0,$currentphase+1);
@@ -8086,7 +7495,7 @@ sub scantron_validate_doublebubble {
sub scantron_get_maxbubble {
- my ($nav_error,$scantron_config) = @_;
+ my ($nav_error) = @_;
if (defined($env{'form.scantron_maxbubble'}) &&
$env{'form.scantron_maxbubble'}) {
&restore_bubble_lines();
@@ -8105,7 +7514,6 @@ sub scantron_get_maxbubble {
}
my $map=$navmap->getResourceByUrl($sequence);
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
- my $bubbles_per_row = &bubblesheet_bubbles_per_row($scantron_config);
&Apache::lonxml::clear_problem_counter();
@@ -8117,14 +7525,11 @@ sub scantron_get_maxbubble {
%first_bubble_line = ();
%subdivided_bubble_lines = ();
%responsetype_per_response = ();
- %masterseq_id_responsenum = ();
my $response_number = 0;
my $bubble_line = 0;
foreach my $resource (@resources) {
- my $resid = $resource->id();
- my ($analysis,$parts) = &scantron_partids_tograde($resource,$cid,$uname,
- $udom,undef,$bubbles_per_row);
+ my ($analysis,$parts) = &scantron_partids_tograde($resource,$cid,$uname,$udom);
if ((ref($analysis) eq 'HASH') && (ref($parts) eq 'ARRAY')) {
foreach my $part_id (@{$parts}) {
my $lines;
@@ -8153,10 +7558,9 @@ sub scantron_get_maxbubble {
if (ref($analysis->{$part_id.'.shown'}) eq 'ARRAY') {
$numshown = scalar(@{$analysis->{$part_id.'.shown'}});
}
- my $bubbles_per_row =
- &bubblesheet_bubbles_per_row($scantron_config);
- my $inner_bubble_lines = int($numbub/$bubbles_per_row);
- if (($numbub % $bubbles_per_row) != 0) {
+ my $bubbles_per_line = 10;
+ my $inner_bubble_lines = int($numbub/$bubbles_per_line);
+ if (($numbub % $bubbles_per_line) != 0) {
$inner_bubble_lines++;
}
for (my $i=0; $i<$numshown; $i++) {
@@ -8167,13 +7571,12 @@ sub scantron_get_maxbubble {
$lines = $numshown * $inner_bubble_lines;
} else {
$lines = $analysis->{"$part_id.bubble_lines"};
- }
+ }
$first_bubble_line{$response_number} = $bubble_line;
$bubble_lines_per_response{$response_number} = $lines;
$responsetype_per_response{$response_number} =
$analysis->{$part_id.'.type'};
- $masterseq_id_responsenum{$resid.'_'.$part_id} = $response_number;
$response_number++;
$bubble_line += $lines;
@@ -8189,76 +7592,26 @@ sub scantron_get_maxbubble {
return $env{'form.scantron_maxbubble'};
}
-sub bubblesheet_bubbles_per_row {
- my ($scantron_config) = @_;
- my $bubbles_per_row;
- if (ref($scantron_config) eq 'HASH') {
- $bubbles_per_row = $scantron_config->{'BubblesPerRow'};
- }
- if ((!$bubbles_per_row) || ($bubbles_per_row < 1)) {
- $bubbles_per_row = 10;
- }
- return $bubbles_per_row;
-}
-
sub scantron_validate_missingbubbles {
my ($r,$currentphase) = @_;
#get student info
my $classlist=&Apache::loncoursedata::get_classlist();
my %idmap=&username_to_idmap($classlist);
- my (undef,undef,$sequence)=
- &Apache::lonnet::decode_symb($env{'form.selectpage'});
#get scantron line setup
my %scantron_config=&get_scantron_config($env{'form.scantron_format'});
my ($scanlines,$scan_data)=&scantron_getfile();
-
- my $navmap = Apache::lonnavmaps::navmap->new();
- unless (ref($navmap)) {
- $r->print(&navmap_errormsg());
- return(1,$currentphase);
- }
-
- my $map=$navmap->getResourceByUrl($sequence);
- my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
- my ($randomorder,$randompick,@master_seq,%symb_to_resource,%grader_partids_by_symb,
- %grader_randomlists_by_symb,%orderedforcode,%respnumlookup,%startline);
- my $bubbles_per_row = &bubblesheet_bubbles_per_row(\%scantron_config);
-
my $nav_error;
- if (ref($map)) {
- $randomorder = $map->randomorder();
- $randompick = $map->randompick();
- if ($randomorder || $randompick) {
- $nav_error = &get_master_seq(\@resources,\@master_seq,\%symb_to_resource);
- if ($nav_error) {
- $r->print(&navmap_errormsg());
- return(1,$currentphase);
- }
- &graders_resources_pass(\@resources,\%grader_partids_by_symb,
- \%grader_randomlists_by_symb,$bubbles_per_row);
- }
- } else {
- $r->print(&navmap_errormsg());
- return(1,$currentphase);
- }
-
-
- my $max_bubble=&scantron_get_maxbubble(\$nav_error,\%scantron_config);
+ my $max_bubble=&scantron_get_maxbubble(\$nav_error);
if ($nav_error) {
- $r->print(&navmap_errormsg());
return(1,$currentphase);
}
-
if (!$max_bubble) { $max_bubble=2**31; }
for (my $i=0;$i<=$scanlines->{'count'};$i++) {
my $line=&scantron_get_line($scanlines,$scan_data,$i);
if ($line=~/^[\s\cz]*$/) { next; }
- my $scan_record =
- &scantron_parse_scanline($line,$i,\%scantron_config,$scan_data,undef,\%idmap,
- $randomorder,$randompick,$sequence,\@master_seq,
- \%symb_to_resource,\%grader_partids_by_symb,
- \%orderedforcode,\%respnumlookup,\%startline);
+ my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config,
+ $scan_data);
if (!defined($$scan_record{'scantron.missingerror'})) { next; }
my @to_correct;
@@ -8267,45 +7620,28 @@ sub scantron_validate_missingbubbles {
foreach my $missing (@{$$scan_record{'scantron.missingerror'}}) {
my $lastbubble;
if ($missing =~ /^(\d+)\.(\d+)$/) {
- my $question = $1;
- my $subquestion = $2;
- my ($first,$responsenum);
- if ($randomorder || $randompick) {
- $responsenum = $respnumlookup{$question-1};
- $first = $startline{$question-1};
- } else {
- $responsenum = $question-1;
- $first = $first_bubble_line{$responsenum};
- }
- if (!defined($first)) { next; }
- my @subans = split(/,/,$subdivided_bubble_lines{$responsenum});
- my $subcount = 1;
- while ($subcount<$subquestion) {
- $first += $subans[$subcount-1];
- $subcount ++;
- }
- my $count = $subans[$subquestion-1];
- $lastbubble = $first + $count;
+ my $question = $1;
+ my $subquestion = $2;
+ if (!defined($first_bubble_line{$question -1})) { next; }
+ my $first = $first_bubble_line{$question-1};
+ my @subans = split(/,/,$subdivided_bubble_lines{$question-1});
+ my $subcount = 1;
+ while ($subcount<$subquestion) {
+ $first += $subans[$subcount-1];
+ $subcount ++;
+ }
+ my $count = $subans[$subquestion-1];
+ $lastbubble = $first + $count;
} else {
- my ($first,$responsenum);
- if ($randomorder || $randompick) {
- $responsenum = $respnumlookup{$missing-1};
- $first = $startline{$missing-1};
- } else {
- $responsenum = $missing-1;
- $first = $first_bubble_line{$responsenum};
- }
- if (!defined($first)) { next; }
- $lastbubble = $first + $bubble_lines_per_response{$responsenum};
+ if (!defined($first_bubble_line{$missing - 1})) { next; }
+ $lastbubble = $first_bubble_line{$missing - 1} + $bubble_lines_per_response{$missing - 1};
}
if ($lastbubble > $max_bubble) { next; }
push(@to_correct,$missing);
}
if (@to_correct) {
&scantron_get_correction($r,$i,$scan_record,\%scantron_config,
- $line,'missingbubble',\@to_correct,
- $randomorder,$randompick,\%respnumlookup,
- \%startline);
+ $line,'missingbubble',\@to_correct);
return (1,$currentphase);
}
@@ -8313,41 +7649,6 @@ sub scantron_validate_missingbubbles {
return (0,$currentphase+1);
}
-sub hand_bubble_option {
- my (undef, undef, $sequence) =
- &Apache::lonnet::decode_symb($env{'form.selectpage'});
- return if ($sequence eq '');
- my $navmap = Apache::lonnavmaps::navmap->new();
- unless (ref($navmap)) {
- return;
- }
- my $needs_hand_bubbles;
- my $map=$navmap->getResourceByUrl($sequence);
- my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
- foreach my $res (@resources) {
- if (ref($res)) {
- if ($res->is_problem()) {
- my $partlist = $res->parts();
- foreach my $part (@{ $partlist }) {
- my @types = $res->responseType($part);
- if (grep(/^(chem|essay|image|formula|math|string|functionplot)$/,@types)) {
- $needs_hand_bubbles = 1;
- last;
- }
- }
- }
- }
- }
- if ($needs_hand_bubbles) {
- my %scantron_config=&get_scantron_config($env{'form.scantron_format'});
- my $bubbles_per_row = &bubblesheet_bubbles_per_row(\%scantron_config);
- return &mt('The sequence to be graded contains response types which are handgraded.').''.
- &mt('If you have already graded these by bubbling sheets to indicate points awarded, [_1]what point value is assigned to a filled last bubble in each row?',' ').
- ' '.&mt('[quant,_1,point]',$bubbles_per_row).' '.&mt('or').' '.
- ' 0 points
';
- }
- return;
-}
sub scantron_process_students {
my ($r) = @_;
@@ -8360,7 +7661,6 @@ sub scantron_process_students {
my $default_form_data=&defaultFormData($symb);
my %scantron_config=&get_scantron_config($env{'form.scantron_format'});
- my $bubbles_per_row = &bubblesheet_bubbles_per_row(\%scantron_config);
my ($scanlines,$scan_data)=&scantron_getfile();
my $classlist=&Apache::loncoursedata::get_classlist();
my %idmap=&username_to_idmap($classlist);
@@ -8368,28 +7668,36 @@ sub scantron_process_students {
unless (ref($navmap)) {
$r->print(&navmap_errormsg());
return '';
- }
+ }
my $map=$navmap->getResourceByUrl($sequence);
- my ($randomorder,$randompick,@master_seq,%symb_to_resource,%grader_partids_by_symb,
- %grader_randomlists_by_symb);
- if (ref($map)) {
- $randomorder = $map->randomorder();
- $randompick = $map->randompick();
- } else {
- $r->print(&navmap_errormsg());
- return '';
- }
- my $nav_error;
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
- if ($randomorder || $randompick) {
- $nav_error = &get_master_seq(\@resources,\@master_seq,\%symb_to_resource);
- if ($nav_error) {
- $r->print(&navmap_errormsg());
- return '';
+ my (%grader_partids_by_symb,%grader_randomlists_by_symb);
+ &graders_resources_pass(\@resources,\%grader_partids_by_symb,
+ \%grader_randomlists_by_symb);
+ my $resource_error;
+ foreach my $resource (@resources) {
+ my $ressymb;
+ if (ref($resource)) {
+ $ressymb = $resource->symb();
+ } else {
+ $resource_error = 1;
+ last;
+ }
+ my ($analysis,$parts) =
+ &scantron_partids_tograde($resource,$env{'request.course.id'},
+ $env{'user.name'},$env{'user.domain'},1);
+ $grader_partids_by_symb{$ressymb} = $parts;
+ if (ref($analysis) eq 'HASH') {
+ if (ref($analysis->{'parts_withrandomlist'}) eq 'ARRAY') {
+ $grader_randomlists_by_symb{$ressymb} =
+ $analysis->{'parts_withrandomlist'};
+ }
}
}
- &graders_resources_pass(\@resources,\%grader_partids_by_symb,
- \%grader_randomlists_by_symb,$bubbles_per_row);
+ if ($resource_error) {
+ $r->print(&navmap_errormsg());
+ return '';
+ }
my ($uname,$udom);
my $result= <print(' ');
@@ -8412,7 +7722,8 @@ SCANTRONFORM
my $i=-1;
my $started;
- &scantron_get_maxbubble(\$nav_error,\%scantron_config); # Need the bubble lines array to parse.
+ my $nav_error;
+ &scantron_get_maxbubble(\$nav_error); # Need the bubble lines array to parse.
if ($nav_error) {
$r->print(&navmap_errormsg());
return '';
@@ -8431,7 +7742,6 @@ SCANTRONFORM
my %lettdig = &letter_to_digits();
my $numletts = scalar(keys(%lettdig));
- my %orderedforcode;
while ($i<$scanlines->{'count'}) {
($uname,$udom)=('','');
@@ -8443,15 +7753,8 @@ SCANTRONFORM
'last student');
}
$started=1;
- my %respnumlookup = ();
- my %startline = ();
- my $total;
my $scan_record=&scantron_parse_scanline($line,$i,\%scantron_config,
- $scan_data,undef,\%idmap,$randomorder,
- $randompick,$sequence,\@master_seq,
- \%symb_to_resource,\%grader_partids_by_symb,
- \%orderedforcode,\%respnumlookup,\%startline,
- \$total);
+ $scan_data);
unless ($uname=&scantron_find_student($scan_record,$scan_data,
\%idmap,$i)) {
&scantron_add_delay(\@delayqueue,$line,
@@ -8463,26 +7766,10 @@ SCANTRONFORM
'Student '.$uname.' has multiple sheets',2);
next;
}
- my $usec = $classlist->{$uname}->[&Apache::loncoursedata::CL_SECTION];
- my $user = $uname.':'.$usec;
($uname,$udom)=split(/:/,$uname);
- my $scancode;
- if ((exists($scan_record->{'scantron.CODE'})) &&
- (&Apache::lonnet::validCODE($scan_record->{'scantron.CODE'}))) {
- $scancode = $scan_record->{'scantron.CODE'};
- } else {
- $scancode = '';
- }
-
- my @mapresources = @resources;
- if ($randomorder || $randompick) {
- @mapresources =
- &users_order($user,$scancode,$sequence,\@master_seq,\%symb_to_resource,
- \%orderedforcode);
- }
my (%partids_by_symb,$res_error);
- foreach my $resource (@mapresources) {
+ foreach my $resource (@resources) {
my $ressymb;
if (ref($resource)) {
$ressymb = $resource->symb();
@@ -8493,8 +7780,7 @@ SCANTRONFORM
if ((exists($grader_randomlists_by_symb{$ressymb})) ||
(ref($grader_partids_by_symb{$ressymb}) ne 'ARRAY')) {
my ($analysis,$parts) =
- &scantron_partids_tograde($resource,$env{'request.course.id'},
- $uname,$udom,undef,$bubbles_per_row);
+ &scantron_partids_tograde($resource,$env{'request.course.id'},$uname,$udom);
$partids_by_symb{$ressymb} = $parts;
} else {
$partids_by_symb{$ressymb} = $grader_partids_by_symb{$ressymb};
@@ -8514,11 +7800,16 @@ SCANTRONFORM
&scantron_putfile($scanlines,$scan_data);
}
+ my $scancode;
+ if ((exists($scan_record->{'scantron.CODE'})) &&
+ (&Apache::lonnet::validCODE($scan_record->{'scantron.CODE'}))) {
+ $scancode = $scan_record->{'scantron.CODE'};
+ } else {
+ $scancode = '';
+ }
+
if (&grade_student_bubbles($r,$uname,$udom,$scan_record,$scancode,
- \@mapresources,\%partids_by_symb,
- $bubbles_per_row,$randomorder,$randompick,
- \%respnumlookup,\%startline)
- eq 'ssi_error') {
+ \@resources,\%partids_by_symb) eq 'ssi_error') {
$ssi_error = 0; # So end of handler error message does not trigger.
$r->print("");
&ssi_print_error($r);
@@ -8527,43 +7818,26 @@ SCANTRONFORM
return ''; # Why return ''? Beats me.
}
- if (($scancode) && ($randomorder || $randompick)) {
- my $parmresult =
- &Apache::lonparmset::storeparm_by_symb($symb,
- '0_examcode',2,$scancode,
- 'string_examcode',$uname,
- $udom);
- }
$completedstudents{$uname}={'line'=>$line};
if ($env{'form.verifyrecord'}) {
my $lastpos = $env{'form.scantron_maxbubble'}*$scantron_config{'Qlength'};
- if ($randompick) {
- if ($total) {
- $lastpos = $total*$scantron_config{'Qlength'};
- }
- }
-
my $studentdata = substr($line,$scantron_config{'Qstart'}-1,$lastpos);
chomp($studentdata);
$studentdata =~ s/\r$//;
my $studentrecord = '';
my $counter = -1;
- foreach my $resource (@mapresources) {
+ foreach my $resource (@resources) {
my $ressymb = $resource->symb();
($counter,my $recording) =
&verify_scantron_grading($resource,$udom,$uname,$env{'request.course.id'},
$counter,$studentdata,$partids_by_symb{$ressymb},
- \%scantron_config,\%lettdig,$numletts,$randomorder,
- $randompick,\%respnumlookup,\%startline);
+ \%scantron_config,\%lettdig,$numletts);
$studentrecord .= $recording;
}
if ($studentrecord ne $studentdata) {
&Apache::lonxml::clear_problem_counter();
if (&grade_student_bubbles($r,$uname,$udom,$scan_record,$scancode,
- \@mapresources,\%partids_by_symb,
- $bubbles_per_row,$randomorder,$randompick,
- \%respnumlookup,\%startline)
- eq 'ssi_error') {
+ \@resources,\%partids_by_symb) eq 'ssi_error') {
$ssi_error = 0; # So end of handler error message does not trigger.
$r->print("");
&ssi_print_error($r);
@@ -8574,23 +7848,21 @@ SCANTRONFORM
}
$counter = -1;
$studentrecord = '';
- foreach my $resource (@mapresources) {
+ foreach my $resource (@resources) {
my $ressymb = $resource->symb();
($counter,my $recording) =
&verify_scantron_grading($resource,$udom,$uname,$env{'request.course.id'},
$counter,$studentdata,$partids_by_symb{$ressymb},
- \%scantron_config,\%lettdig,$numletts,
- $randomorder,$randompick,\%respnumlookup,
- \%startline);
+ \%scantron_config,\%lettdig,$numletts);
$studentrecord .= $recording;
}
if ($studentrecord ne $studentdata) {
- $r->print('');
+ $r->print('');
if ($scancode eq '') {
- $r->print(&mt('Mismatch grading bubblesheet for user: [_1] with ID: [_2].',
+ $r->print(&mt('Mismatch grading bubble sheet for user: [_1] with ID: [_2].',
$uname.':'.$udom,$scan_record->{'scantron.ID'}));
} else {
- $r->print(&mt('Mismatch grading bubblesheet for user: [_1] with ID: [_2] and CODE: [_3].',
+ $r->print(&mt('Mismatch grading bubble sheet for user: [_1] with ID: [_2] and CODE: [_3].',
$uname.':'.$udom,$scan_record->{'scantron.ID'},$scancode));
}
$r->print(' '.&Apache::loncommon::start_data_table()."\n".
@@ -8598,12 +7870,12 @@ SCANTRONFORM
'
'.&mt('Source').' '.&mt('Bubbled responses').' '.
&Apache::loncommon::end_data_table_header_row()."\n".
&Apache::loncommon::start_data_table_row().
- ''.&mt('Bubblesheet').' '.
- ''.$studentdata.' '.
+ ''.&mt('Bubble Sheet').' '.
+ ''.$studentdata.' '.
&Apache::loncommon::end_data_table_row().
&Apache::loncommon::start_data_table_row().
- ''.&mt('Stored submissions').' '.
- ''.$studentrecord.' '."\n".
+ 'Stored submissions '.
+ ''.$studentrecord.' '."\n".
&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table().'
');
} else {
@@ -8630,16 +7902,14 @@ SCANTRONFORM
}
sub graders_resources_pass {
- my ($resources,$grader_partids_by_symb,$grader_randomlists_by_symb,
- $bubbles_per_row) = @_;
+ my ($resources,$grader_partids_by_symb,$grader_randomlists_by_symb) = @_;
if ((ref($resources) eq 'ARRAY') && (ref($grader_partids_by_symb)) &&
(ref($grader_randomlists_by_symb) eq 'HASH')) {
foreach my $resource (@{$resources}) {
my $ressymb = $resource->symb();
my ($analysis,$parts) =
&scantron_partids_tograde($resource,$env{'request.course.id'},
- $env{'user.name'},$env{'user.domain'},
- 1,$bubbles_per_row);
+ $env{'user.name'},$env{'user.domain'},1);
$grader_partids_by_symb->{$ressymb} = $parts;
if (ref($analysis) eq 'HASH') {
if (ref($analysis->{'parts_withrandomlist'}) eq 'ARRAY') {
@@ -8652,67 +7922,8 @@ sub graders_resources_pass {
return;
}
-=pod
-
-=item users_order
-
- Returns array of resources in current map, ordered based on either CODE,
- if this is a CODEd exam, or based on student's identity if this is a
- "NAMEd" exam.
-
- Should be used when randomorder and/or randompick applied when the
- corresponding exam was printed, prior to students completing bubblesheets
- for the version of the exam the student received.
-
-=cut
-
-sub users_order {
- my ($user,$scancode,$mapurl,$master_seq,$symb_to_resource,$orderedforcode) = @_;
- my @mapresources;
- unless ((ref($master_seq) eq 'ARRAY') && (ref($symb_to_resource) eq 'HASH')) {
- return @mapresources;
- }
- if ($scancode) {
- if ((ref($orderedforcode) eq 'HASH') && (ref($orderedforcode->{$scancode}) eq 'ARRAY')) {
- @mapresources = @{$orderedforcode->{$scancode}};
- } else {
- $env{'form.CODE'} = $scancode;
- my $actual_seq =
- &Apache::lonprintout::master_seq_to_person_seq($mapurl,
- $master_seq,
- $user,$scancode,1);
- if (ref($actual_seq) eq 'ARRAY') {
- @mapresources = map { $symb_to_resource->{$_}; } @{$actual_seq};
- if (ref($orderedforcode) eq 'HASH') {
- if (@mapresources > 0) {
- $orderedforcode->{$scancode} = \@mapresources;
- }
- }
- }
- delete($env{'form.CODE'});
- }
- } else {
- my $actual_seq =
- &Apache::lonprintout::master_seq_to_person_seq($mapurl,
- $master_seq,
- $user,undef,1);
- if (ref($actual_seq) eq 'ARRAY') {
- @mapresources =
- map { $symb_to_resource->{$_}; } @{$actual_seq};
- }
- }
- return @mapresources;
-}
-
sub grade_student_bubbles {
- my ($r,$uname,$udom,$scan_record,$scancode,$resources,$parts,$bubbles_per_row,
- $randomorder,$randompick,$respnumlookup,$startline) = @_;
- my $uselookup = 0;
- if (($randomorder || $randompick) && (ref($respnumlookup) eq 'HASH') &&
- (ref($startline) eq 'HASH')) {
- $uselookup = 1;
- }
-
+ my ($r,$uname,$udom,$scan_record,$scancode,$resources,$parts) = @_;
if (ref($resources) eq 'ARRAY') {
my $count = 0;
foreach my $resource (@{$resources}) {
@@ -8725,21 +7936,11 @@ sub grade_student_bubbles {
'grade_symb' => $ressymb,
'CODE' => $scancode
);
- if ($bubbles_per_row ne '') {
- $form{'bubbles_per_row'} = $bubbles_per_row;
- }
- if ($env{'form.scantron_lastbubblepoints'} ne '') {
- $form{'scantron_lastbubblepoints'} = $env{'form.scantron_lastbubblepoints'};
- }
if (ref($parts) eq 'HASH') {
if (ref($parts->{$ressymb}) eq 'ARRAY') {
foreach my $part (@{$parts->{$ressymb}}) {
- if ($uselookup) {
- $form{'scantron_questnum_start.'.$part} = $startline->{$count} + 1;
- } else {
- $form{'scantron_questnum_start.'.$part} =
- 1+$env{'form.scantron.first_bubble_line.'.$count};
- }
+ $form{'scantron_questnum_start.'.$part} =
+ 1+$env{'form.scantron.first_bubble_line.'.$count};
$count++;
}
}
@@ -8761,13 +7962,11 @@ sub scantron_upload_scantron_data {
'domainid',
'coursename',$dom);
my $syllabuslink = ''.&mt('Syllabus').' '.
- (' 'x2).&mt('(shows course personnel)');
- my ($symb) = &get_symb($r,1);
- my $default_form_data=&defaultFormData($symb);
+ (' 'x2).&mt('(shows course personnel)');
+ my $default_form_data=&defaultFormData(&get_symb($r,1));
my $nofile_alert = &mt('Please use the browse button to select a file from your local directory.');
my $nocourseid_alert = &mt("Please use the 'Select Course' link to open a separate window where you can search for a course to which a file can be uploaded.");
- $r->print('
-
-
-'.&mt('Send bubblesheet data to a course').'
+'));
+ $r->print('
+'.&mt('Send scanned bubblesheet data to a course').'
\n";
my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box.");
- $request->print(<
+ $request->print(&Apache::lonhtmlcommon::scripttag(<
GRADINGMENUJS
&commonJSfunctions($request);
return $Str;
}
+sub individual {
+ my ($request)=@_;
+ &submit_options($request);
+}
+
+sub ungraded {
+ my ($request)=@_;
+ &submit_options($request);
+}
+
+sub table {
+ my ($request)=@_;
+ &submit_options($request);
+}
+
+sub all_for_one {
+ my ($request)=@_;
+ &submit_options($request);
+}
+
+sub submit_options_sequence {
+ my ($request) = @_;
+ my ($symb)=&get_symb($request);
+ if (!$symb) {return '';}
+ my $probTitle = &Apache::lonnet::gettitle($symb);
+
+ my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box.");
+ $request->print(&Apache::lonhtmlcommon::scripttag(<'.$section.''."\n";
+ }
+ }
+
+ $result.='';
+ $result .= &show_grading_menu_form($symb);
+ return $result;
+}
#--- Displays the submissions first page -------
sub submit_options {
@@ -9554,8 +8815,7 @@ sub submit_options {
my $probTitle = &Apache::lonnet::gettitle($symb);
my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box.");
- $request->print(<
+ $request->print(&Apache::lonhtmlcommon::scripttag(<
GRADINGMENUJS
&commonJSfunctions($request);
- my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle);
+# my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle);
my $result;
my (undef,$sections) = &getclasslist('all','0');
my $savedState = &savedState();
@@ -9611,7 +8870,7 @@ GRADINGMENUJS
$result.='';
$result .= &show_grading_menu_form($symb);
return $result;
@@ -9731,21 +8972,6 @@ sub init_perm {
}
}
-sub init_old_essays {
- my ($symb,$apath,$adom,$aname) = @_;
- if ($symb ne '') {
- my %essays = &Apache::lonnet::dump('nohist_essay_'.$apath,$adom,$aname);
- if (keys(%essays) > 0) {
- $old_essays{$symb} = \%essays;
- }
- }
- return;
-}
-
-sub reset_old_essays {
- undef(%old_essays);
-}
-
sub gather_clicker_ids {
my %clicker_ids;
@@ -9813,13 +9039,13 @@ sub process_clicker {
if (!$symb) {return '';}
my $result=&checkforfile_js();
$env{'form.probTitle'} = &Apache::lonnet::gettitle($symb);
- my ($table) = &showResourceInfo($symb,$env{'form.probTitle'});
- $result.=$table;
+# my ($table) = &showResourceInfo($symb,$env{'form.probTitle'});
+# $result.=$table;
$result.=''."\n";
$result.=''."\n";
$result.=' '.&mt('Specify a file containing the clicker information for this resource.').
' '."\n";
- $result.=''."\n";
+ $result.=' '."\n";
# Attempt to restore parameters from last session, set defaults if not present
my %Saveable_Parameters=&clicker_grading_parameters();
&Apache::loncommon::restore_course_settings('grades_clicker',
@@ -9846,12 +9072,10 @@ sub process_clicker {
my $pcorrect=&mt("Percentage points for correct solution");
my $pincorrect=&mt("Percentage points for incorrect solution");
my $selectform=&Apache::loncommon::select_form($env{'form.upfiletype'},'upfiletype',
- {'iclicker' => 'i>clicker',
- 'interwrite' => 'interwrite PRS',
- 'turning' => 'Turning Technologies'});
+ ('iclicker' => 'i>clicker',
+ 'interwrite' => 'interwrite PRS'));
$symb = &Apache::lonenc::check_encrypt($symb);
- $result.=<
+ $result.= &Apache::lonhtmlcommon::scripttag(<
+ENDUPFORM
+ $result.= <
@@ -9908,7 +9133,7 @@ function sanitycheck() {
$pcorrect:
$pincorrect:
-
+'
ENDUPFORM
$result.='
'."\n".
'
'."\n";
@@ -9924,8 +9149,8 @@ sub process_clicker_file {
my %Saveable_Parameters=&clicker_grading_parameters();
&Apache::loncommon::store_course_settings('grades_clicker',
\%Saveable_Parameters);
-
- my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
+ my $result='';
+# my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
if (($env{'form.gradingmechanism'} eq 'specific') && ($env{'form.specificid'}!~/\w/)) {
$result.=''.&mt('You need to specify a clicker ID for the correct answer').' ';
return $result.&show_grading_menu_form($symb);
@@ -9938,7 +9163,7 @@ sub process_clicker_file {
if ($env{'form.gradingmechanism'} eq 'given') {
$env{'form.givenanswer'}=~s/^\s*//gs;
$env{'form.givenanswer'}=~s/\s*$//gs;
- $env{'form.givenanswer'}=~s/[^a-zA-Z0-9\.\*\-\+]+/\,/g;
+ $env{'form.givenanswer'}=~s/[^a-zA-Z0-9\.\*\-]+/\,/g;
$env{'form.givenanswer'}=uc($env{'form.givenanswer'});
my @answers=split(/\,/,$env{'form.givenanswer'});
$foundgiven=$#answers+1;
@@ -9977,18 +9202,16 @@ sub process_clicker_file {
$number++;
}
$result.="\n";
- if ($number==0) {
- $result .=
- &Apache::lonhtmlcommon::confirm_success(
- &mt('No IDs found to determine correct answer'),1);
- return $result,.&show_grading_menu_form($symb);
- }
+ if ($number==0) {
+ $result.=''.&mt('No IDs found to determine correct answer').' ';
+ return $result.&show_grading_menu_form($symb);
+ }
}
if (length($env{'form.upfile'}) < 2) {
- $result .=
- &Apache::lonhtmlcommon::confirm_success(
- &mt('The file: [_1] you attempted to upload contained no information. Please check that you entered the correct filename.',
- ''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').' '),1);
+ $result.=&mt('[_1] Error: [_2] The file you attempted to upload, [_3] contained no information. Please check that you entered the correct filename.',
+ '',
+ ' ',
+ ''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').' ');
return $result.&show_grading_menu_form($symb);
}
@@ -10000,7 +9223,7 @@ sub process_clicker_file {
$result.=(<