('.
+ &mt('Compose message to student').(scalar(@$col_fullnames) >= 1 ? 's' : '').' ('.
&mt('incl. grades').' )'.
- ' dir_config('lonIconsURL').
'/mailbkgrd.gif" width="14" height="10" name="mailicon'.$counter.'" />'."\n".
' ('.
&mt('Message will be sent when you click on Save & Next below.').")\n";
@@ -2627,187 +2599,10 @@ sub keywords_highlight {
return $string;
}
-# For Tasks provide a mechanism to display previous version for one specific student
-
-sub show_previous_task_version {
- my ($request,$symb) = @_;
- if ($symb eq '') {
- $request->print("Unable to handle ambiguous references.");
-
- return '';
- }
- my ($uname,$udom) = ($env{'form.student'},$env{'form.userdom'});
- my $usec = &Apache::lonnet::getsection($udom,$uname,$env{'request.course.id'});
- if (!&canview($usec)) {
- $request->print('Unable to view previous version for requested student.('.
- $uname.':'.$udom.' in section '.$usec.' in course id '.
- $env{'request.course.id'}.') ');
- return;
- }
- my $mode = 'both';
- my $isTask = ($symb =~/\.task$/);
- if ($isTask) {
- if ($env{'form.previousversion'} =~ /^\d+$/) {
- if ($env{'form.fullname'} eq '') {
- $env{'form.fullname'} =
- &Apache::loncommon::plainname($uname,$udom,'lastname');
- }
- my $probtitle=&Apache::lonnet::gettitle($symb);
- $request->print("\n\n".
- ''.
- '
'.&nameUserString(undef,$env{'form.fullname'},$uname,$udom).
- ' '."\n");
- &Apache::lonxml::clear_problem_counter();
- $request->print(&show_problem($request,$symb,$uname,$udom,1,1,$mode,
- {'previousversion' => $env{'form.previousversion'} }));
- $request->print("\n");
- }
- }
- return;
-}
-
-sub choose_task_version_form {
- my ($symb,$uname,$udom,$nomenu) = @_;
- my $isTask = ($symb =~/\.task$/);
- my ($current,$version,$result,$js,$displayed,$rowtitle);
- if ($isTask) {
- my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},
- $udom,$uname);
- if (($record{'resource.0.version'} eq '') ||
- ($record{'resource.0.version'} < 2)) {
- return ($record{'resource.0.version'},
- $record{'resource.0.version'},$result,$js);
- } else {
- $current = $record{'resource.0.version'};
- }
- if ($env{'form.previousversion'}) {
- $displayed = $env{'form.previousversion'};
- $rowtitle = &mt('Choose another version:')
- } else {
- $displayed = $current;
- $rowtitle = &mt('Show earlier version:');
- }
- $result = '';
- my $list;
- my $numversions = 0;
- for (my $i=1; $i<=$record{'resource.0.version'}; $i++) {
- if ($i == $current) {
- if (!$env{'form.previousversion'} || $nomenu) {
- next;
- } else {
- $list .= '
'.&mt('Current').' '."\n";
- $numversions ++;
- }
- } elsif (defined($record{'resource.'.$i.'.0.status'})) {
- unless ($i == $env{'form.previousversion'}) {
- $numversions ++;
- }
- $list .= '
'.$i.' '."\n";
- }
- }
- if ($numversions) {
- $symb = &HTML::Entities::encode($symb,'<>"&');
- $result .=
- '
';
- $js = &previous_display_javascript($nomenu,$current);
- } elsif ($displayed && $nomenu) {
- $result .= '
'.&mt('Close window').' ';
- } else {
- $result .= &mt('No previous versions to show for this student');
- }
- $result .= '
';
- }
- return ($current,$displayed,$result,$js);
-}
-
-sub previous_display_javascript {
- my ($nomenu,$current) = @_;
- my $js = <<"JSONE";
-
-ENDJS
-
-}
-
#--- Called from submission routine
sub processHandGrade {
my ($request) = shift;
- my ($symb) = &get_symb($request);
+ my $symb = &get_symb($request);
my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb);
my $button = $env{'form.gradeOpt'};
my $ngrade = $env{'form.NCT'};
@@ -3212,11 +3007,9 @@ sub handback_files {
&file_name_version_ext($answer_file);
my ($portfolio_path) = ($directory =~ /^.+$stuname\/portfolio(.*)/);
my $getpropath = 1;
- my ($dir_list,$listerror) =
- &Apache::lonnet::dirlist($portfolio_root.$portfolio_path,
- $domain,$stuname,$getpropath);
- my $version = &get_next_version($answer_name,$answer_ext,$dir_list);
- # fix filename
+ my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$portfolio_path,$domain,$stuname,$getpropath);
+ my $version = &get_next_version($answer_name, $answer_ext, \@dir_list);
+ # fix file name
my ($save_file_name) = (($directory.$answer_name.".$version.".$answer_ext) =~ /^.+\/${stuname}\/(.*)/);
my $result=&Apache::lonnet::finishuserfileupload($stuname,$domain,
$newflg.'_'.$part_resp.'_returndoc'.$counter,
@@ -3236,7 +3029,7 @@ sub handback_files {
$file_msg.=''.$save_file_name." ";
}
- $request->print(' '.&mt('[_1] will be the uploaded filename [_2]',''.$fname.' ',''.$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$counter}.' '));
+ $request->print(' '.&mt('[_1] will be the uploaded file name [_2]',''.$fname.' ',''.$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$counter}.' '));
}
}
}
@@ -3375,11 +3168,9 @@ sub version_portfiles {
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*)$/);
my ($answer_name,$answer_ver,$answer_ext) =
&file_name_version_ext($answer_file);
- my $getpropath = 1;
- my ($dir_list,$listerror) =
- &Apache::lonnet::dirlist($portfolio_root.$directory,$domain,
- $stu_name,$getpropath);
- my $version = &get_next_version($answer_name,$answer_ext,$dir_list);
+ my $getpropath = 1;
+ my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$directory,$domain,$stu_name,$getpropath);
+ my $version = &get_next_version($answer_name, $answer_ext, \@dir_list);
my $new_answer = &version_selected_portfile($domain, $stu_name, $directory, $answer_file, $version);
if ($new_answer ne 'problem getting file') {
push(@versioned_portfiles, $directory.$new_answer);
@@ -3398,24 +3189,21 @@ sub version_portfiles {
sub get_next_version {
my ($answer_name, $answer_ext, $dir_list) = @_;
my $version;
- if (ref($dir_list) eq 'ARRAY') {
- foreach my $row (@{$dir_list}) {
- my ($file) = split(/\&/,$row,2);
- my ($file_name,$file_version,$file_ext) =
- &file_name_version_ext($file);
- if (($file_name eq $answer_name) &&
- ($file_ext eq $answer_ext)) {
- # gets here if filename and extension match,
- # regardless of version
+ foreach my $row (@$dir_list) {
+ my ($file) = split(/\&/,$row,2);
+ my ($file_name,$file_version,$file_ext) =
+ &file_name_version_ext($file);
+ if (($file_name eq $answer_name) &&
+ ($file_ext eq $answer_ext)) {
+ # gets here if filename and extension match, regardless of version
if ($file_version ne '') {
- # a versioned file is found so save it for later
- if ($file_version > $version) {
- $version = $file_version;
- }
+ # a versioned file is found so save it for later
+ if ($file_version > $version) {
+ $version = $file_version;
}
}
}
- }
+ }
$version ++;
return($version);
}
@@ -3642,7 +3430,7 @@ sub viewgrades {
&Apache::lonnet::clear_EXT_cache_status();
my $result=''.&mt('Manual Grading').' ';
- $result.=''.&mt('Current Resource').': '.$env{'form.probTitle'}.' '."\n";
+ $result.=''.&mt('Current Resource: [_1]',$env{'form.probTitle'}).' '."\n";
#view individual student submission form - called using Javascript viewOneStudent
$result.=&jscriptNform($symb);
@@ -3705,9 +3493,8 @@ sub viewgrades {
$partid.'" size="4" '.'onchange="javascript:writePoint(\''.
$partid.'\','.$weight{$partid}.',\'textval\')" /> /'.
$weight{$partid}.' '.&mt('(problem weight)').''."\n";
- $line.= ''.&mt('Grade Status').': '.
- ''.&mt('Grade Status').': '.
' '.
''.&mt('excused').' '.
@@ -3754,8 +3541,8 @@ sub viewgrades {
my $display_part=&get_display_part($partid,$symb);
if ($display =~ /^Partial Credit Factor/) {
$result.=''.
- &mt('Score Part: [_1][_2](weight = [_3])',
- $display_part,' ',$weight{$partid}).' '."\n";
+ &mt('Score Part: [_1] (weight = [_2])',
+ $display_part,$weight{$partid}).''."\n";
next;
} else {
@@ -3876,11 +3663,11 @@ sub viewstudentgrade {
sub editgrades {
my ($request) = @_;
- my ($symb)=&get_symb($request);
+ my $symb=&get_symb($request);
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section'));
my $title=''.&mt('Current Grade Status').' ';
- $title.=''.&mt('Current Resource').': '.$env{'form.probTitle'}.' '."\n";
- $title.=''.&mt('Section:').' '.$section_display.' '."\n";
+ $title.=''.&mt('Current Resource: [_1]',$env{'form.probTitle'}).' '."\n";
+ $title.=''.&mt('Section: [_1]',$section_display).' '."\n";
my $result= &Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
@@ -4265,12 +4052,11 @@ sub csvupload_fields {
sub csvuploadmap_footer {
my ($request,$i,$keyfields) =@_;
- my $buttontext = &mt('Assign Grades');
$request->print(<
-
+
ENDPICK
}
@@ -4414,7 +4200,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 '';
@@ -4822,8 +4608,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 +4691,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();
@@ -4926,9 +4711,7 @@ sub displaySubByDates {
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,9 +4719,6 @@ 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}) {
@@ -4958,7 +4738,7 @@ 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).')'
@@ -5230,7 +5010,7 @@ 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
@@ -5320,11 +5100,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 +5113,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 +5128,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 +5162,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;
}
@@ -5693,7 +5477,7 @@ sub scantron_selectphase {
&Apache::lonpickcode::code_list($r,2);
- $r->print(' ");
&ssi_print_error($r);
@@ -8527,43 +7945,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,14 +7975,12 @@ 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) {
@@ -8599,11 +7998,11 @@ SCANTRONFORM
&Apache::loncommon::end_data_table_header_row()."\n".
&Apache::loncommon::start_data_table_row().
' '.&mt('Bubblesheet').' '.
- ''.$studentdata.' '.
+ ''.$studentdata.' '.
&Apache::loncommon::end_data_table_row().
&Apache::loncommon::start_data_table_row().
''.&mt('Stored submissions').' '.
- ''.$studentrecord.' '."\n".
+ ''.$studentrecord.' '."\n".
&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table().'');
} else {
@@ -8630,16 +8029,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 +8049,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 +8063,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,9 +8089,8 @@ 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('
@@ -8968,18 +8295,17 @@ sub valid_file {
sub scantron_download_scantron_data {
my ($r)=@_;
- my ($symb) = &get_symb($r,1);
- my $default_form_data=&defaultFormData($symb);
+ my $default_form_data=&defaultFormData(&get_symb($r,1));
my $cname=$env{'course.'.$env{'request.course.id'}.'.num'};
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'};
my $file=$env{'form.scantron_selectfile'};
if (! &valid_file($file)) {
$r->print('
- '.&mt('The requested filename was invalid.').'
+ '.&mt('The requested file name was invalid.').'
');
- $r->print(&show_grading_menu_form($symb));
+ $r->print(&show_grading_menu_form(&get_symb($r,1)));
return;
}
my $orig='/uploaded/'.$cdom.'/'.$cname.'/scantron_orig_'.$file;
@@ -9002,7 +8328,7 @@ sub scantron_download_scantron_data {
'',' ').'
');
- $r->print(&show_grading_menu_form($symb));
+ $r->print(&show_grading_menu_form(&get_symb($r,1)));
return '';
}
@@ -9020,7 +8346,6 @@ sub checkscantron_results {
my %record;
my %scantron_config =
&Apache::grades::get_scantron_config($env{'form.scantron_format'});
- my $bubbles_per_row = &bubblesheet_bubbles_per_row(\%scantron_config);
my ($scanlines,$scan_data)=&Apache::grades::scantron_getfile();
my $classlist=&Apache::loncoursedata::get_classlist();
my %idmap=&Apache::grades::username_to_idmap($classlist);
@@ -9030,20 +8355,10 @@ sub checkscantron_results {
return '';
}
my $map=$navmap->getResourceByUrl($sequence);
- my ($randomorder,$randompick,@master_seq,%symb_to_resource,%grader_partids_by_symb,
- %grader_randomlists_by_symb,%orderedforcode);
- if (ref($map)) {
- $randomorder=$map->randomorder();
- $randompick=$map->randompick();
- }
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
- my $nav_error = &get_master_seq(\@resources,\@master_seq,\%symb_to_resource);
- if ($nav_error) {
- $r->print(&navmap_errormsg());
- return '';
- }
- &graders_resources_pass(\@resources,\%grader_partids_by_symb,
- \%grader_randomlists_by_symb,$bubbles_per_row);
+ my (%grader_partids_by_symb,%grader_randomlists_by_symb);
+ &graders_resources_pass(\@resources,\%grader_partids_by_symb, \%grader_randomlists_by_symb);
+
my ($uname,$udom);
my (%scandata,%lastname,%bylast);
$r->print('
@@ -9052,10 +8367,13 @@ sub checkscantron_results {
my @delayqueue;
my %completedstudents;
- my $count=&get_todo_count($scanlines,$scan_data);
- my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,$count);
- my ($username,$domain,$started,%ordered);
- &scantron_get_maxbubble(\$nav_error,\%scantron_config); # Need the bubble lines array to parse.
+ my $count=&Apache::grades::get_todo_count($scanlines,$scan_data);
+ my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Bubblesheet/Submissions Comparison Status',
+ 'Progress of Bubblesheet Data/Submission Records Comparison',$count,
+ 'inline',undef,'checkscantron');
+ my ($username,$domain,$started);
+ my $nav_error;
+ &scantron_get_maxbubble(\$nav_error); # Need the bubble lines array to parse.
if ($nav_error) {
$r->print(&navmap_errormsg());
return '';
@@ -9079,8 +8397,8 @@ sub checkscantron_results {
my $scan_record=
&Apache::grades::scantron_parse_scanline($line,$i,\%scantron_config,
$scan_data);
- unless ($uname=&scantron_find_student($scan_record,$scan_data,
- \%idmap,$i)) {
+ unless ($uname=&Apache::grades::scantron_find_student($scan_record,$scan_data,
+ \%idmap,$i)) {
&Apache::grades::scantron_add_delay(\@delayqueue,$line,
'Unable to find a student that matches',1);
next;
@@ -9093,57 +8411,26 @@ sub checkscantron_results {
my $pid = $scan_record->{'scantron.ID'};
$lastname{$pid} = $scan_record->{'scantron.LastName'};
push(@{$bylast{$lastname{$pid}}},$pid);
- my $usec = $classlist->{$uname}->[&Apache::loncoursedata::CL_SECTION];
- my $user = $uname.':'.$usec;
- ($username,$domain)=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;
my $lastpos = $env{'form.scantron_maxbubble'}*$scantron_config{'Qlength'};
- my %respnumlookup=();
- my %startline=();
- if ($randomorder || $randompick) {
- @mapresources =
- &users_order($user,$scancode,$sequence,\@master_seq,\%symb_to_resource,
- \%orderedforcode);
- my $total = &get_respnum_lookups($sequence,$scan_data,\%idmap,$line,
- $scan_record,\@master_seq,\%symb_to_resource,
- \%grader_partids_by_symb,\%orderedforcode,
- \%respnumlookup,\%startline);
- if ($randompick && $total) {
- $lastpos = $total*$scantron_config{'Qlength'};
- }
- }
$scandata{$pid} = substr($line,$scantron_config{'Qstart'}-1,$lastpos);
chomp($scandata{$pid});
$scandata{$pid} =~ s/\r$//;
-
+ ($username,$domain)=split(/:/,$uname);
my $counter = -1;
- foreach my $resource (@mapresources) {
+ foreach my $resource (@resources) {
my $parts;
my $ressymb = $resource->symb();
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'},
- $username,$domain,undef,
- $bubbles_per_row);
+ &scantron_partids_tograde($resource,$env{'request.course.id'},$username,$domain);
} else {
$parts = $grader_partids_by_symb{$ressymb};
}
($counter,my $recording) =
&verify_scantron_grading($resource,$domain,$username,$cid,$counter,
$scandata{$pid},$parts,
- \%scantron_config,\%lettdig,$numletts,
- $randomorder,$randompick,
- \%respnumlookup,\%startline);
+ \%scantron_config,\%lettdig,$numletts);
$record{$pid} .= $recording;
}
}
@@ -9189,11 +8476,7 @@ sub checkscantron_results {
$env{'form.scantron_maxbubble'}).
''
);
- $r->print(''
- .&mt('Exact matches for [_1][quant,_2,student][_3].','',$passed,' ')
- .' '
- .&mt('Discrepancies detected for [_1][quant,_2,student][_3].','',$failed,' ')
- .'
');
+ $r->print(''.&mt('Exact matches for [quant,_1,student] .',$passed).' '.&mt('Discrepancies detected for [quant,_1,student] .',$failed).'
');
if ($passed) {
$r->print(&mt('Students with exact correspondence between bubblesheet data and submissions are as follows:').' ');
$r->print(&Apache::loncommon::start_data_table()."\n".
@@ -9219,8 +8502,7 @@ sub checkscantron_results {
sub verify_scantron_grading {
my ($resource,$domain,$username,$cid,$counter,$scandata,$partids,
- $scantron_config,$lettdig,$numletts,$randomorder,$randompick,
- $respnumlookup,$startline) = @_;
+ $scantron_config,$lettdig,$numletts) = @_;
my ($record,%expected,%startpos);
return ($counter,$record) if (!ref($resource));
return ($counter,$record) if (!$resource->is_problem());
@@ -9229,21 +8511,15 @@ sub verify_scantron_grading {
foreach my $part_id (@{$partids}) {
$counter ++;
$expected{$part_id} = 0;
- my $respnum = $counter;
- if ($randomorder || $randompick) {
- $respnum = $respnumlookup->{$counter};
- $startpos{$part_id} = $startline->{$counter} + 1;
- } else {
- $startpos{$part_id} = $env{"form.scantron.first_bubble_line.$counter"};
- }
- if ($env{"form.scantron.sub_bubblelines.$respnum"}) {
- my @sub_lines = split(/,/,$env{"form.scantron.sub_bubblelines.$respnum"});
+ if ($env{"form.scantron.sub_bubblelines.$counter"}) {
+ my @sub_lines = split(/,/,$env{"form.scantron.sub_bubblelines.$counter"});
foreach my $item (@sub_lines) {
$expected{$part_id} += $item;
}
} else {
- $expected{$part_id} = $env{"form.scantron.bubblelines.$respnum"};
+ $expected{$part_id} = $env{"form.scantron.bubblelines.$counter"};
}
+ $startpos{$part_id} = $env{"form.scantron.first_bubble_line.$counter"};
}
if ($symb) {
my %recorded;
@@ -9339,7 +8615,7 @@ sub verify_scantron_grading {
return ($counter,$record);
}
-sub letter_to_digits {
+sub letter_to_digits {
my %lettdig = (
A => 1,
B => 2,
@@ -9386,13 +8662,6 @@ sub savedState {
return \%savedState;
}
-#--- Href with symb and command ---
-
-sub href_symb_cmd {
- my ($symb,$cmd)=@_;
- return '/adm/grades?symb='.&HTML::Entities::encode(&Apache::lonenc::check_encrypt($symb),'<>&"').'&command='.$cmd;
-}
-
sub grading_menu {
my ($request) = @_;
my ($symb)=&get_symb($request);
@@ -9816,8 +9085,7 @@ sub process_clicker {
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'});
+ 'interwrite' => 'interwrite PRS'});
$symb = &Apache::lonenc::check_encrypt($symb);
$result.=<
@@ -9990,9 +9258,6 @@ ENDHEADER
if ($env{'form.upfiletype'} eq 'interwrite') {
($errormsg,$number)=&interwrite_eval(\@questiontitles,\%responses);
}
- if ($env{'form.upfiletype'} eq 'turning') {
- ($errormsg,$number)=&turning_eval(\@questiontitles,\%responses);
- }
$result.=' '.&mt('Found [_1] question(s)',$number).' '.
' '.
&mt('Awarding [_1] percent for correct and [_2] percent for incorrect responses',
@@ -10047,7 +9312,7 @@ ENDHEADER
&mt('Found [_1] registered and [_2] unregistered clickers.',$student_count,$unknown_count);
if (($env{'form.gradingmechanism'} ne 'attendance') && ($env{'form.gradingmechanism'} ne 'given')) {
if ($correct_count==0) {
- $errormsg.="Found no correct answers for grading!";
+ $errormsg.="Found no correct answers answers for grading!";
} elsif ($correct_count>1) {
$result.=''.&mt("Found [_1] entries for grading!",$correct_count).' ';
}
@@ -10124,31 +9389,6 @@ sub interwrite_eval {
return ($errormsg,$number);
}
-sub turning_eval {
- my ($questiontitles,$responses)=@_;
- my $number=0;
- my $errormsg='';
- foreach my $line (split(/[\n\r]/,$env{'form.upfile'})) {
- my %components=&Apache::loncommon::record_sep($line);
- my @entries=map {$components{$_}} (sort(keys(%components)));
- if ($#entries>$number) { $number=$#entries; }
- my $id=$entries[0];
- my @idresponses;
- $id=~s/^[\#0]+//;
- unless ($id) { next; }
- for (my $idx=1;$idx<=$#entries;$idx++) {
- $entries[$idx]=~s/\,/\;/g;
- $entries[$idx]=~s/[^a-zA-Z0-9\.\*\-\+\;]+//g;
- push(@idresponses,$entries[$idx]);
- }
- $$responses{$id}=join(',',@idresponses);
- }
- for (my $i=1; $i<=$number; $i++) {
- $$questiontitles[$i]=&mt('Question [_1]',$i);
- }
- return ($errormsg,$number);
-}
-
sub assign_clicker_grades {
my ($r)=@_;
my ($symb)=&get_symb($r);
@@ -10222,7 +9462,7 @@ sub assign_clicker_grades {
if ($user) {
if ($users{$user}) {
$result.=''.
- &mt('More than one entry found for [_1]!',''.$user.' ').
+ &mt("More than one entry found for [_1] !",$user).
' ';
}
$users{$user}=1;
@@ -10290,19 +9530,6 @@ sub navmap_errormsg {
'';
}
-sub startpage {
- my ($r,$symb,$crumbs,$onlyfolderflag,$nodisplayflag,$stuvcurrent,$stuvdisp,$nomenu,$js) = @_;
- if ($nomenu) {
- $r->print(&Apache::loncommon::start_page("Student's Version",$js,{'only_body' => '1'}));
- } else {
- $r->print(&Apache::loncommon::start_page('Grading',$js,
- {'bread_crumbs' => $crumbs}));
- }
- unless ($nodisplayflag) {
- $r->print(&Apache::lonhtmlcommon::resource_info_box($symb,$onlyfolderflag,$stuvcurrent,$stuvdisp));
- }
-}
-
sub handler {
my $request=$_[0];
&reset_caches();
@@ -10324,7 +9551,7 @@ sub handler {
$ssi_error = 0;
my $brcrum = [{href=>"/adm/grades",text=>"Grading"}];
my $start_page = &Apache::loncommon::start_page('Grading',undef,
- {'bread_crumbs' => $brcrum});
+ {'bread_crumbs' => $brcrum});
if ($symb eq '' && $command eq '') {
if ($env{'user.adv'}) {
&Apache::loncommon::content_type($request,'text/html');
@@ -10357,7 +9584,6 @@ sub handler {
&init_perm();
if (!%perm) {
$request->internal_redirect('/adm/quickgrades');
- return OK;
} else {
&Apache::loncommon::content_type($request,'text/html');
$request->send_http_header;
@@ -10378,33 +9604,9 @@ sub handler {
}
&Apache::loncommon::content_type($request,'text/html');
$request->send_http_header;
- unless ((($command eq 'submission' || $command eq 'versionsub')) && ($perm{'vgr'})) {
- $request->print($start_page);
- }
+ $request->print($start_page);
if ($command eq 'submission' && $perm{'vgr'}) {
- my ($stuvcurrent,$stuvdisp,$versionform,$js);
- if (($env{'form.student'} ne '') && ($env{'form.userdom'} ne '')) {
- ($stuvcurrent,$stuvdisp,$versionform,$js) =
- &choose_task_version_form($symb,$env{'form.student'},
- $env{'form.userdom'});
- }
- &startpage($request,$symb,[{href=>"", text=>"Student Submissions"}],undef,undef,$stuvcurrent,$stuvdisp,undef,$js);
- if ($versionform) {
- $request->print($versionform);
- }
- $request->print(' ');
($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0));
- } elsif ($command eq 'versionsub' && $perm{'vgr'}) {
- my ($stuvcurrent,$stuvdisp,$versionform,$js) =
- &choose_task_version_form($symb,$env{'form.student'},
- $env{'form.userdom'},
- $env{'form.inhibitmenu'});
- &startpage($request,$symb,[{href=>"", text=>"Previous Student Version"}],undef,undef,$stuvcurrent,$stuvdisp,$env{'form.inhibitmenu'},$js);
- if ($versionform) {
- $request->print($versionform);
- }
- $request->print(' ');
- $request->print(&show_previous_task_version($request,$symb));
} elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) {
&pickStudentPage($request);
} elsif ($command eq 'displayPage' && $perm{'vgr'}) {
@@ -10575,16 +9777,6 @@ ssi_with_retries()
- missingbubble - array ref of the bubble lines that have missing
bubble errors
- $randomorder - True if exam folder has randomorder set
- $randompick - True if exam folder has randompick set
- $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.
-
-
=item scantron_get_maxbubble() :
Arguments:
@@ -10594,8 +9786,6 @@ ssi_with_retries()
calling routine should trap the error condition and display the warning
found in &navmap_errormsg().
- $scantron_config - Reference to bubblesheet format configuration hash.
-
Returns the maximum number of bubble lines that are expected to
occur. Does this by walking the selected sequence rendering the
resource and then checking &Apache::lonxml::get_problem_counter()
@@ -10605,7 +9795,7 @@ ssi_with_retries()
$env{'form.scantron.bubble_lines.n'},
$env{'form.scantron.first_bubble_line.n'} and
$env{"form.scantron.sub_bubblelines.n"}
- 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,
and a comma separated list of numbers of bubble lines for sub-questions
(for optionresponse, matchresponse, and rankresponse items), for response n.