--- loncom/homework/grades.pm 2010/04/13 10:21:21 1.614
+++ 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.614 2010/04/13 10:21:21 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) = @_;
@@ -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("$viewgrade Submissions for a Student or a Group of Students")
+ .&mt("View/Grade/Regrade Submissions for a Student or a Group of Students")
.'
';
-
- my ($partlist,$handgrade,$responseType) = &response_type($symb
-#,$res_error
- );
+ my $res_error;
+ my ($partlist,$handgrade,$responseType) = &response_type($symb,\$res_error);
my %lt = &Apache::lonlocal::texthash (
'multiple' => 'Please select a student or group of students before clicking on the Next button.',
@@ -918,11 +919,10 @@ LISTJAVASCRIPT
&build_section_inputs().
''."\n".
' '."\n".
- ' '."\n".
''."\n".
''."\n";
- if (exists($env{'form.gradingMenu'}) && exists($env{'form.Status'})) {
+ if (exists($env{'form.Status'})) {
$gradeTable .= ''."\n";
} else {
$gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Student Status'))
@@ -937,7 +937,7 @@ LISTJAVASCRIPT
.&Apache::lonhtmlcommon::end_pick_box();
$gradeTable .= '
'
- .&mt('To '.lc($viewgrade)." a submission or a group of submissions, click on the check box(es) next to the student's name(s). Then click on the Next button.")."\n"
+ .&mt("To view/grade/regrade a submission or a group of submissions, click on the check box(es) next to the student's name(s). Then click on the Next button.")."\n"
.''
.'
';
- if ($env{'form.showgrading'} eq 'yes'
- && $submitonly ne 'queued'
- && $submitonly ne 'all') {
+ if (($submitonly ne 'queued') && ($submitonly ne 'all')) {
foreach (@$partlist) {
$gradeTable.='
';
}
@@ -1135,7 +1129,7 @@ sub check_buttons {
# Displays the submissions for one student or a group of students
sub processGroup {
- my ($request) = shift;
+ my ($request,$symb) = @_;
my $ctr = 0;
my @stuchecked = &Apache::loncommon::get_env_multiple('form.stuinfo');
my $total = scalar(@stuchecked)-1;
@@ -1145,7 +1139,7 @@ sub processGroup {
$env{'form.student'} = $uname;
$env{'form.userdom'} = $udom;
$env{'form.fullname'} = $fullname;
- &submission($request,$ctr,$total);
+ &submission($request,$ctr,$total,$symb);
$ctr++;
}
return '';
@@ -1283,7 +1277,6 @@ sub sub_page_js {
}
if (val == "Grade Student") {
- formname.showgrading.value = "yes";
if (formname.Status.value == "") {
formname.Status.value = "Active";
}
@@ -1747,8 +1740,8 @@ sub gradeBox {
}
sub handback_box {
- my ($symb,$uname,$udom,$counter,$partid,$record,$res_error) = @_;
- my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error);
+ my ($symb,$uname,$udom,$counter,$partid,$record,$res_error_pointer) = @_;
+ my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error_pointer);
my (@respids);
my @part_response_id = &flatten_responseType($responseType);
foreach my $part_response_id (@part_response_id) {
@@ -1852,6 +1845,11 @@ sub files_exist {
sub download_all_link {
my ($r,$symb) = @_;
+ unless (&files_exist($r, $symb)) {
+ $r->print(&mt('There are currently no submitted documents.'));
+ return;
+ }
+
my $all_students =
join("\n", &Apache::loncommon::get_env_multiple('form.stuinfo'));
@@ -1864,7 +1862,14 @@ sub download_all_link {
'cgi.'.$identifier.'.parts' => $parts,});
$r->print(''.
&mt('Download All Submitted Documents').'');
- return
+ return;
+}
+
+sub submit_download_link {
+ my ($request,$symb) = @_;
+ if (!$symb) { return ''; }
+#FIXME: Figure out which type of problem this is and provide appropriate download
+ &download_all_link($request,$symb);
}
sub build_section_inputs {
@@ -1910,10 +1915,7 @@ sub submission {
# header info
if ($counter == 0) {
&sub_page_js($request);
- &sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes');
- if ($env{'form.handgrade'} eq 'yes' && &files_exist($request, $symb)) {
- &download_all_link($request, $symb);
- }
+ &sub_page_kw_js($request);
$request->print('
'.&mt('Submission Record').'
');
# option to display problem, only once else it cause problems
@@ -1958,7 +1960,6 @@ sub submission {
''."\n".
''."\n".
''."\n".
- ''."\n".
''."\n".
''."\n".
''."\n".
@@ -1992,7 +1993,7 @@ sub submission {
}
$request->print($prnmsg);
- if ($env{'form.handgrade'} eq 'yes' && $env{'form.showgrading'} eq 'yes') {
+ if ($env{'form.handgrade'} eq 'yes') {
#
# Print out the keyword options line
#
@@ -2128,7 +2129,7 @@ KEYWORDS
$lastsubonly.="\n".'