--- loncom/homework/grades.pm 2008/12/10 21:30:38 1.528.2.1
+++ loncom/homework/grades.pm 2008/12/15 20:55:38 1.536
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.528.2.1 2008/12/10 21:30:38 raeburn Exp $
+# $Id: grades.pm,v 1.536 2008/12/15 20:55:38 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -26,6 +26,8 @@
# http://www.lon-capa.org/
#
+
+
package Apache::grades;
use strict;
use Apache::style;
@@ -58,46 +60,6 @@ my $ssi_error_resource;
my $ssi_error_message;
-# Do an ssi with retries:
-# While I'd love to factor out this with the vesrion in lonprintout,
-# that would either require a data coupling between modules, which I refuse to perpetuate
-# (there's quite enough of that already), or would require the invention of another infrastructure
-# I'm not quite ready to invent (e.g. an ssi_with_retry object).
-#
-# At least the logic that drives this has been pulled out into loncommon.
-
-
-#
-# ssi_with_retries - Does the server side include of a resource.
-# if the ssi call returns an error we'll retry it up to
-# the number of times requested by the caller.
-# If we still have a proble, no text is appended to the
-# output and we set some global variables.
-# to indicate to the caller an SSI error occurred.
-# All of this is supposed to deal with the issues described
-# in LonCAPA BZ 5631 see:
-# http://bugs.lon-capa.org/show_bug.cgi?id=5631
-# by informing the user that this happened.
-#
-# Parameters:
-# resource - The resource to include. This is passed directly, without
-# interpretation to lonnet::ssi.
-# form - The form hash parameters that guide the interpretation of the resource
-#
-# retries - Number of retries allowed before giving up completely.
-# Returns:
-# On success, returns the rendered resource identified by the resource parameter.
-# Side Effects:
-# The following global variables can be set:
-# ssi_error - If an unrecoverable error occurred this becomes true.
-# It is up to the caller to initialize this to false
-# if desired.
-# ssi_error_resource - If an unrecoverable error occurred, this is the value
-# of the resource that could not be rendered by the ssi
-# call.
-# ssi_error_message - The error string fetched from the ssi response
-# in the event of an error.
-#
sub ssi_with_retries {
my ($resource, $retries, %form) = @_;
my ($content, $response) = &Apache::loncommon::ssi_with_retries($resource, $retries, %form);
@@ -2796,8 +2758,10 @@ sub handback_files {
$newflg.'_'.$part_resp.'_returndoc'.$file_counter,
$save_file_name);
if ($result !~ m|^/uploaded/|) {
- $request->print('An error occurred ('.$result.
- ') while trying to upload '.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'
');
+ $request->print('
'.
+ &mt('An error occurred ([_1]) while trying to upload [_2].',
+ $result,$newflg.'_'.$part_resp.'_returndoc'.$file_counter).
+ '');
} else {
# mark the file as read only
my @files = ($save_file_name);
@@ -6611,14 +6575,7 @@ sub scantron_validate_sequence {
return (0,$currentphase+1);
}
-=pod
-
-=item scantron_validate_ID
-
- Validates all scanlines in the selected file to not have any
- invalid or underspecified student IDs
-=cut
sub scantron_validate_ID {
my ($r,$currentphase) = @_;
@@ -6684,35 +6641,6 @@ sub scantron_validate_ID {
return (0,$currentphase+1);
}
-=pod
-
-=item scantron_get_correction
-
- Builds the interface screen to interact with the operator to fix a
- specific error condition in a specific scanline
-
- Arguments:
- $r - Apache request object
- $i - number of the current scanline
- $scan_record - hash ref as returned from &scantron_parse_scanline()
- $scan_config - hash ref as returned from &get_scantron_config()
- $line - full contents of the current scanline
- $error - error condition, valid values are
- 'incorrectCODE', 'duplicateCODE',
- 'doublebubble', 'missingbubble',
- 'duplicateID', 'incorrectID'
- $arg - extra information needed
- For errors:
- - duplicateID - paper number that this studentID was seen before on
- - duplicateCODE - array ref of the paper numbers this CODE was
- seen on before
- - incorrectCODE - current incorrect CODE
- - doublebubble - array ref of the bubble lines that have double
- bubble errors
- - missingbubble - array ref of the bubble lines that have missing
- bubble errors
-
-=cut
sub scantron_get_correction {
my ($r,$i,$scan_record,$scan_config,$line,$error,$arg)=@_;
@@ -7283,25 +7211,6 @@ sub scantron_validate_doublebubble {
return (0,$currentphase+1);
}
-=pod
-
-=item scantron_get_maxbubble
-
- 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()
- for what the current value of the problem counter is.
-
- Caches the results to $env{'form.scantron_maxbubble'},
- $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
- 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.
-
-=cut
sub scantron_get_maxbubble {
if (defined($env{'form.scantron_maxbubble'}) &&
@@ -7444,15 +7353,6 @@ sub scantron_get_maxbubble {
return $env{'form.scantron_maxbubble'};
}
-=pod
-
-=item scantron_validate_missingbubbles
-
- Validates all scanlines in the selected file to not have any
- answers that don't have bubbles that have not been verified
- to be bubble free.
-
-=cut
sub scantron_validate_missingbubbles {
my ($r,$currentphase) = @_;
@@ -7507,29 +7407,6 @@ sub scantron_validate_missingbubbles {
return (0,$currentphase+1);
}
-=pod
-
-=item scantron_process_students
-
- Routine that does the actual grading of the bubble sheet information.
-
- The parsed scanline hash is added to %env
-
- Then foreach unskipped scanline it does an &Apache::lonnet::ssi()
- foreach resource , with the form data of
-
- 'submitted' =>'scantron'
- 'grade_target' =>'grade',
- 'grade_username'=> username of student
- 'grade_domain' => domain of student
- 'grade_courseid'=> of course
- 'grade_symb' => symb of resource to grade
-
- This triggers a grading pass. The problem grading code takes care
- of converting the bubbled letter information (now in %env) into a
- valid submission.
-
-=cut
sub scantron_process_students {
my ($r) = @_;
@@ -7660,14 +7537,6 @@ SCANTRONFORM
return '';
}
-=pod
-
-=item scantron_upload_scantron_data
-
- Creates the screen for adding a new bubble sheet data file to a course.
-
-=cut
-
sub scantron_upload_scantron_data {
my ($r)=@_;
$r->print(&Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'}));
@@ -7708,14 +7577,6 @@ sub scantron_upload_scantron_data {
return '';
}
-=pod
-
-=item scantron_upload_scantron_data_save
-
- Adds a provided bubble information data file to the course if user
- has the correct privileges to do so.
-
-=cut
sub scantron_upload_scantron_data_save {
my($r)=@_;
@@ -7777,14 +7638,6 @@ sub scantron_upload_scantron_data_save {
return '';
}
-=pod
-
-=item valid_file
-
- Validates that the requested bubble data file exists in the course.
-
-=cut
-
sub valid_file {
my ($requested_file)=@_;
foreach my $filename (sort(&scantron_filenames())) {
@@ -7793,16 +7646,6 @@ sub valid_file {
return 0;
}
-=pod
-
-=item scantron_download_scantron_data
-
- Shows a list of the three internal files (original, corrected,
- skipped) for a specific bubble sheet data file that exists in the
- course.
-
-=cut
-
sub scantron_download_scantron_data {
my ($r)=@_;
my $default_form_data=&defaultFormData(&get_symb($r,1));
@@ -8107,11 +7950,6 @@ sub checkscantron_results {
return;
}
-=pod
-
-=back
-
-=cut
#-------- end of section for handling grading scantron forms -------
#
@@ -8314,6 +8152,15 @@ GRADINGMENUJS
my $saveSub = ($$savedState{'saveSub'} eq '' ? 'all' : $$savedState{'saveSub'});
my $saveStatus = ($$savedState{'saveStatus'} eq '' ? 'Active' : $$savedState{'saveStatus'});
+ # Preselect sections
+ my $selsec="";
+ if (ref($sections)) {
+ foreach my $section (sort(@$sections)) {
+ $selsec.=''."\n";
+ }
+ }
+
$result.='