--- loncom/homework/grades.pm 2010/04/12 22:19:53 1.613 +++ loncom/homework/grades.pm 2010/04/22 13:00:24 1.630 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.613 2010/04/12 22:19:53 www Exp $ +# $Id: grades.pm,v 1.630 2010/04/22 13:00:24 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,6 +43,7 @@ use Apache::lonmsg(); use Apache::Constants qw(:common); use Apache::lonlocal; use Apache::lonenc; +use Apache::lonstathelpers; use String::Similarity; use LONCAPA; @@ -137,6 +138,7 @@ sub nameUserString { #--- Get the partlist and the response type for a given problem. --- #--- Indicate if a response type is coded handgraded or not. --- +#--- Sets response_error pointer to "1" if navmaps object broken --- sub response_type { my ($symb,$response_error) = @_; @@ -800,7 +802,7 @@ sub verifyreceipt { $contents. &Apache::loncommon::end_data_table()."\n"; } - return $string.&show_grading_menu_form($symb); + return $string; } #--- This is called by a number of programs. @@ -808,22 +810,21 @@ sub verifyreceipt { #--- Also called directly when one clicks on the subm button # on the problem page. sub listStudents { - my ($request,$symb) = @_; + my ($request,$symb,$submitonly) = @_; my $cdom = $env{"course.$env{'request.course.id'}.domain"}; my $cnum = $env{"course.$env{'request.course.id'}.num"}; my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'}; my $getgroup = $env{'form.group'} eq '' ? 'all' : $env{'form.group'}; - my $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'}; - my $viewgrade = $env{'form.showgrading'} eq 'yes' ? 'View/Grade/Regrade' : 'View'; + unless ($submitonly) { + $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'}; + } my $result='
'.
&mt('Number of records updated = [_1] for [quant,_2,student].',
$rec_update,$count).' ".
&mt("Failed to save data for student [_1]. Message when trying to save was: [_2]",
"$username:$domain",$result)." took $lasttime
'.
@@ -3830,8 +3825,6 @@ sub csvuploadmap_header {
}
my $result='';
- my $checked=(($env{'form.noFirstLine'})?' checked="checked"':'');
- my $ignore=&mt('Ignore First Line');
$symb = &Apache::lonenc::check_encrypt($symb);
$request->print(<
-
@@ -3931,14 +3923,12 @@ sub upcsvScores_form {
$upfile_select
-
ENDUPFORM
$result.=&Apache::loncommon::help_open_topic("Course_Convert_To_CSV",
&mt("How do I create a CSV file from a spreadsheet"))
.''."\n";
$result.='
'."\n";
- $result.=&show_grading_menu_form($symb);
return $result;
}
@@ -3955,7 +3945,6 @@ sub csvuploadmap {
&Apache::loncommon::load_tmp_file($request);
}
my @records=&Apache::loncommon::upfile_record_sep();
- if ($env{'form.noFirstLine'}) { shift(@records); }
&csvuploadmap_header($request,$symb,$datatoken,$#records+1);
my ($i,$keyfields);
if (@records) {
@@ -3985,15 +3974,12 @@ sub csvuploadmap {
}
}
&csvuploadmap_footer($request,$i,$keyfields);
- $request->print(&show_grading_menu_form($symb));
return '';
}
sub csvuploadoptions {
my ($request,$symb)= @_;
- my $checked=(($env{'form.noFirstLine'})?'1':'0');
- my $ignore=&mt('Ignore First Line');
$request->print(<Uploading Class Grade Options
@@ -4029,7 +4015,6 @@ ENDPICK
# FIXME do a check for any invalid user ids?...
$request->print('
'."\n");
- $request->print(&show_grading_menu_form($symb));
return '';
}
@@ -4056,7 +4041,6 @@ sub csvuploadassign {
my $error_msg = '';
&Apache::loncommon::load_tmp_file($request);
my @gradedata = &Apache::loncommon::upfile_record_sep();
- if ($env{'form.noFirstLine'}) { shift(@gradedata); }
my %fields=&get_fields();
$request->print('Assigning Grades
');
my $courseid=$env{'request.course.id'};
@@ -4138,14 +4122,20 @@ sub csvuploadassign {
$env{'request.course.id'},
$domain,$username);
if ($result eq 'ok') {
+# Successfully stored
$request->print('.');
- } else {
+# 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);
+ $countdone++;
+ } else {
$request->print("
'.&Apache::lonhtmlcommon::confirm_success(&mt("Saved scores for [quant,_1,student]",$countdone),$countdone==0));
@@ -4158,7 +4148,6 @@ sub csvuploadassign {
$request->print(join(', ',@notallowed));
}
$request->print("
\n");
- $request->print(&show_grading_menu_form($symb));
return $error_msg;
}
#------------- end of section for handling csv file upload ---------
@@ -4288,7 +4277,6 @@ LISTJAVASCRIPT
$studentTable.=''."\n";
- $studentTable.=&show_grading_menu_form($symb);
$request->print($studentTable);
return '';
@@ -4343,7 +4331,6 @@ sub displayPage {
if (!&canview($usec)) {
$request->print(''.&mt('Unable to view requested student. ([_1])',$env{'form.student'}).'');
- $request->print(&show_grading_menu_form($symb));
return;
}
my $result=' '.$env{'form.title'}.'
';
@@ -4361,14 +4348,12 @@ sub displayPage {
my $navmap = Apache::lonnavmaps::navmap->new();
unless (ref($navmap)) {
$request->print(&navmap_errormsg());
- $request->print(&show_grading_menu_form($symb));
return;
}
my ($mapUrl, $id, $resUrl)=&Apache::lonnet::decode_symb($env{'form.page'});
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
if (!$map) {
$request->print(''.&mt('Unable to view requested sequence. ([_1])',$resUrl).'');
- $request->print(&show_grading_menu_form($symb));
return;
}
my $iterator = $navmap->getIterator($map->map_start(),
@@ -4483,7 +4468,6 @@ sub displayPage {
''.
''."\n";
- $studentTable.=&show_grading_menu_form($symb);
$request->print($studentTable);
return '';
@@ -4547,7 +4531,7 @@ sub displaySubByDates {
$displaySub[0].=''.&mt('Part: [_1]',$display_part).''
.' '
- .'('.&mt('Part ID: [_1]',$responseId).')'
+ .'('.&mt('Response ID: [_1]',$responseId).')'
.''
.' ';
if ($hidden) {
@@ -4621,7 +4605,6 @@ sub updateGradeByPage {
my $usec=$classlist->{$env{'form.student'}}[5];
if (!&canmodify($usec)) {
$request->print(''.&mt('Unable to modify requested student ([_1])',$env{'form.student'}).'');
- $request->print(&show_grading_menu_form($env{'form.symb'}));
return;
}
my $result=' '.$env{'form.title'}.'
';
@@ -4640,7 +4623,6 @@ sub updateGradeByPage {
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
if (!$map) {
$request->print(''.&mt('Unable to grade requested sequence ([_1]).',$resUrl).'');
- $request->print(&show_grading_menu_form($symb));
return;
}
my $iterator = $navmap->getIterator($map->map_start(),
@@ -4766,7 +4748,6 @@ sub updateGradeByPage {
}
$studentTable.=&Apache::loncommon::end_data_table();
- $studentTable.=&show_grading_menu_form($env{'form.symb'});
my $grademsg=($changeflag == 0 ? &mt('No score was changed or updated.') :
&mt('The scores were changed for [quant,_1,problem].',
$changeflag));
@@ -5139,7 +5120,6 @@ sub scantron_selectphase {
return;
}
my $default_form_data=&defaultFormData($symb);
- my $grading_menu_button=&show_grading_menu_form($symb);
my $file_selector=&scantron_uploads($file2grade);
my $format_selector=&scantron_scantab();
my $CODE_selector=&scantron_CODElist();
@@ -5301,7 +5281,6 @@ sub scantron_selectphase {
&Apache::loncommon::end_data_table_row()."\n".
&Apache::loncommon::end_data_table()."\n".
'
');
- $r->print($grading_menu_button);
return;
}
@@ -6226,7 +6205,7 @@ sub scantron_do_warning {
');
}
- $r->print("
".&show_grading_menu_form($symb));
+ $r->print("
");
return '';
}
@@ -6374,7 +6353,7 @@ sub scantron_validate_file {
$r->print(" ".&mt("this scanline saving it for later."));
}
}
- $r->print("
".&show_grading_menu_form($symb));
+ $r->print("
");
return '';
}
@@ -7637,7 +7616,6 @@ SCANTRONFORM
if ($ssi_error) {
$r->print("");
&ssi_print_error($r);
- $r->print(&show_grading_menu_form($symb));
&Apache::lonnet::remove_lock($lock);
return ''; # Dunno why the other returns return '' rather than just returning.
}
@@ -7715,7 +7693,6 @@ SCANTRONFORM
$ssi_error = 0; # So end of handler error message does not trigger.
$r->print("");
&ssi_print_error($r);
- $r->print(&show_grading_menu_form($symb));
&Apache::lonnet::remove_lock($lock);
return ''; # Why return ''? Beats me.
}
@@ -7743,7 +7720,6 @@ SCANTRONFORM
$ssi_error = 0; # So end of handler error message does not trigger.
$r->print("");
&ssi_print_error($r);
- $r->print(&show_grading_menu_form($symb));
&Apache::lonnet::remove_lock($lock);
delete($completedstudents{$uname});
return '';
@@ -7799,7 +7775,6 @@ SCANTRONFORM
# $r->print("
");
- if ($symb) {
- $r->print(&show_grading_menu_form($symb));
- } else {
+ unless ($symb) {
$r->print($doanotherupload);
}
return '';
@@ -8078,7 +8051,6 @@ sub scantron_download_scantron_data {
'.&mt('The requested file name was invalid.').'
'.&mt('Access Denied ([_1])',$command).'
'); } }