--- loncom/homework/grades.pm 2010/04/12 12:55:18 1.611
+++ loncom/homework/grades.pm 2010/04/18 18:45:41 1.623
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.611 2010/04/12 12:55:18 www Exp $
+# $Id: grades.pm,v 1.623 2010/04/18 18:45:41 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) = @_;
@@ -617,7 +619,6 @@ sub jscriptNform {
"\n");
$jscript.= '
'.
&mt('Number of records updated = [_1] for [quant,_2,student].',
$rec_update,$count).' '.
@@ -3856,7 +3841,6 @@ to this page if the data selected is ins
-
ENDPICK
@@ -3934,7 +3918,6 @@ sub upcsvScores_form {
'."\n");
- $request->print(&show_grading_menu_form($symb));
return '';
}
@@ -4164,7 +4144,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 ---------
@@ -4248,8 +4227,7 @@ LISTJAVASCRIPT
my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status'));
$result.=''."\n".
''."\n".
- ''."\n".
- ''." \n";
+ ''." \n";
$result.=' '.&mt('Use CODE').': '."\n";
@@ -4295,7 +4273,6 @@ LISTJAVASCRIPT
$studentTable.=''."\n";
- $studentTable.=&show_grading_menu_form($symb);
$request->print($studentTable);
return '';
@@ -4350,7 +4327,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'}.'
';
@@ -4368,14 +4344,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(),
@@ -4388,8 +4362,7 @@ sub displayPage {
''."\n".
''."\n".
''."\n".
- ''."\n".
- ''."\n";
+ ''."\n";
if (defined($env{'form.CODE'})) {
$studentTable.=
@@ -4491,7 +4464,6 @@ sub displayPage {
''.
''."\n";
- $studentTable.=&show_grading_menu_form($symb);
$request->print($studentTable);
return '';
@@ -4629,7 +4601,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'}.'
';
@@ -4648,7 +4619,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(),
@@ -4774,7 +4744,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));
@@ -4852,8 +4821,7 @@ the homework problem.
sub defaultFormData {
my ($symb)=@_;
- return ''."\n".
- '';
+ return '';
}
@@ -5148,7 +5116,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();
@@ -5310,7 +5277,6 @@ sub scantron_selectphase {
&Apache::loncommon::end_data_table_row()."\n".
&Apache::loncommon::end_data_table()."\n".
' ');
- $r->print($grading_menu_button);
return;
}
@@ -6235,7 +6201,7 @@ sub scantron_do_warning {
');
}
- $r->print(" ".&show_grading_menu_form($symb));
+ $r->print(" ");
return '';
}
@@ -6383,7 +6349,7 @@ sub scantron_validate_file {
$r->print(" ".&mt("this scanline saving it for later."));
}
}
- $r->print(" ".&show_grading_menu_form($symb));
+ $r->print(" ");
return '';
}
@@ -7646,7 +7612,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.
}
@@ -7724,7 +7689,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.
}
@@ -7752,7 +7716,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 '';
@@ -7808,7 +7771,6 @@ SCANTRONFORM
# $r->print("
took $lasttime
");
$r->print("");
- $r->print(&show_grading_menu_form($symb));
return '';
}
@@ -7944,9 +7906,7 @@ sub scantron_upload_scantron_data_save {
!&Apache::lonnet::allowed('usc',
$env{'form.domainid'}.'_'.$env{'form.courseid'})) {
$r->print(&mt("You are not allowed to upload bubblesheet data to the requested course.")." ");
- if ($symb) {
- $r->print(&show_grading_menu_form($symb));
- } else {
+ unless ($symb) {
$r->print($doanotherupload);
}
return '';
@@ -7974,7 +7934,7 @@ sub scantron_upload_scantron_data_save {
}
}
if ($symb) {
- $r->print(&scantron_selectphase($r,$uploadedfile));
+ $r->print(&scantron_selectphase($r,$uploadedfile,$symb));
} else {
$r->print($doanotherupload);
}
@@ -8087,7 +8047,6 @@ sub scantron_download_scantron_data {
'.&mt('The requested file name was invalid.').'
');
- $r->print(&show_grading_menu_form($symb));
return;
}
my $orig='/uploaded/'.$cdom.'/'.$cname.'/scantron_orig_'.$file;
@@ -8110,14 +8069,12 @@ sub scantron_download_scantron_data {
'','').'
');
- $r->print(&show_grading_menu_form($symb));
return '';
}
sub checkscantron_results {
my ($r,$symb) = @_;
if (!$symb) {return '';}
- my $grading_menu_button=&show_grading_menu_form($symb);
my $cid = $env{'request.course.id'};
my %lettdig = &letter_to_digits();
my $numletts = scalar(keys(%lettdig));
@@ -8270,7 +8227,7 @@ sub checkscantron_results {
&Apache::loncommon::end_data_table()).' '.
&mt('Differences can occur if submissions were modified using manual grading after a bubblesheet grading pass.').' '.&mt('If unexpected discrepancies were detected, it is recommended that you inspect the original bubblesheets.');
}
- $r->print(' '.$grading_menu_button);
+ $r->print(' ');
return;
}
@@ -8412,16 +8369,11 @@ sub letter_to_digits {
#-------------------------- Menu interface -------------------------
#
-#--- Show a Grading Menu button - Calls the next routine ---
-sub show_grading_menu_form {
- my ($symb)=@_;
- my $result.=' '."\n";
- return $result;
+#--- 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 {
@@ -8429,9 +8381,7 @@ sub grading_menu {
if (!$symb) {return '';}
my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb),
- 'command'=>'individual',
- 'gradingMenu'=>1,
- 'showgrading'=>"yes");
+ 'command'=>'individual');
my $url1a = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
@@ -8444,6 +8394,9 @@ sub grading_menu {
$fields{'command'}='all_for_one';
my $url1d=&Apache::lonhtmlcommon::build_url('grades/',\%fields);
+ $fields{'command'}='downloadfilesselect';
+ my $url1e=&Apache::lonhtmlcommon::build_url('grades/',\%fields);
+
$fields{'command'} = 'csvform';
my $url2 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
@@ -8477,11 +8430,17 @@ sub grading_menu {
icon => 'edit-find-replace.png',
linktitle => 'Grade current resource for all students.'
},
- { linktext => 'Grade complete page/sequence/folder for one student',
+ { linktext => 'Grade page/folder for one student',
url => $url1d,
permission => 'F',
icon => 'edit-find-replace.png',
linktitle => 'Grade all resources in current page/sequence/folder for one student.'
+ },
+ { linktext => 'Download submissions',
+ url => $url1e,
+ permission => 'F',
+ icon => 'edit-find-replace.png',
+ linktitle => 'Download all students submissions.'
}]},
{ categorytitle=>'Automated Grading',
items =>[
@@ -8504,7 +8463,7 @@ sub grading_menu {
icon => 'stat.png',
linktitle => 'Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.'
},
- { linktext => 'Verify Receipt No.',
+ { linktext => 'Verify Receipt Number',
url => $url5,
permission => 'F',
icon => 'edit-find-replace.png',
@@ -8518,9 +8477,7 @@ sub grading_menu {
my $Str;
$Str .= '';
- $result .= &show_grading_menu_form($symb);
return $result;
}
@@ -8565,9 +8518,7 @@ sub submit_options_table {
my $result;
$result.='';
- $result .= &show_grading_menu_form($symb);
return $result;
}
+sub submit_options_download {
+ my ($request,$symb) = @_;
+ if (!$symb) {return '';}
+
+ &commonJSfunctions($request);
+
+ my $result='';
+ return $result;
+}
#--- Displays the submissions first page -------
sub submit_options {
@@ -8595,10 +8565,7 @@ sub submit_options {
my $result;
$result.='';
- $result .= &show_grading_menu_form($symb);
return $result;
}
@@ -8822,7 +8788,6 @@ ENDUPFORM
'."\n".
'