--- loncom/homework/grades.pm 2008/11/11 16:40:47 1.529
+++ loncom/homework/grades.pm 2008/12/20 04:04:36 1.538
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.529 2008/11/11 16:40:47 jms Exp $
+# $Id: grades.pm,v 1.538 2008/12/20 04:04:36 schulted Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -26,182 +26,7 @@
# http://www.lon-capa.org/
#
-=head1 NAME
-
-Apache::grades
-
-=head1 SYNOPSIS
-
-Handles the viewing of grades.
-
-This is part of the LearningOnline Network with CAPA project
-described at http://www.lon-capa.org.
-
-=head1 OVERVIEW
-
-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.
-
-
-=head1 HANDLER SUBROUTINE
-
-ssi_with_retries()
-
-=head1 OTHER SUBROUTINES
-
-=over
-
-=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
-=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.
-
-
-=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.
-
-=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.
-
-=item *
-
-scantron_upload_scantron_data() :
-
- Creates the screen for adding a new bubble sheet data file to a course.
-
-=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.
-
-=item *
-
-valid_file() :
-
- Validates that the requested bubble data file exists in the course.
-
-=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.
-
-=item *
-
-scantron_validate_ID() :
-
- Validates all scanlines in the selected file to not have any
- invalid or underspecified student IDs
-
-=back
-
-=cut
package Apache::grades;
use strict;
@@ -1818,7 +1643,7 @@ sub gradeBox {
my $radio.='
'."\n"; # display radio buttons in a nice table 10 across
while ($thisweight<=$wgt) {
- $radio.= '
\n";
@@ -2933,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);
@@ -3969,8 +3796,8 @@ sub upcsvScores_form {
$result.=$table;
$result.='
'."\n";
$result.='
'."\n";
- $result.=' '.&mt('Specify a file containing the class scores for current resource').
- '.
'."\n";
+ $result.=' '.&mt('Specify a file containing the class scores for current resource.').
+ ''."\n";
$result.='
'."\n";
my $upload=&mt("Upload Scores");
my $upfile_select=&Apache::loncommon::upfile_select_html();
@@ -5122,11 +4949,11 @@ sub scantron_CODElist {
=cut
sub scantron_CODEunique {
- my $result='
+ my $result=''.&mt('Yes').'
-
+ '.&mt('No').' ';
@@ -8169,36 +7996,49 @@ sub grading_menu {
'saveState'=>"",
'gradingMenu'=>1,
'showgrading'=>"yes");
- my $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
- my @menu = ({ url => $url,
- name => &mt('Manual Grading/View Submissions'),
- short_description =>
- &mt('Start the process of hand grading submissions.'),
- });
+
+ my $url1 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
+
$fields{'command'} = 'csvform';
- $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
- push(@menu, { url => $url,
- name => &mt('Upload Scores'),
- short_description =>
- &mt('Specify a file containing the class scores for current resource.')});
+ my $url2 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
+
$fields{'command'} = 'processclicker';
- $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
- push(@menu, { url => $url,
- name => &mt('Process Clicker'),
- short_description =>
- &mt('Specify a file containing the clicker information for this resource.')});
+ my $url3 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
+
$fields{'command'} = 'scantron_selectphase';
- $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
- push(@menu, { url => $url,
- name => &mt('Grade/Manage/Review Scantron Forms'),
- short_description =>
- &mt('Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.')});
- $fields{'command'} = 'verify';
- $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
- push(@menu, { url => "",
- name => &mt('Verify Receipt'),
- short_description =>
- &mt('')});
+ my $url4 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
+
+ my @menu = ({ categorytitle=>'Course Grading',
+ items =>[
+ { linktext => 'Manual Grading/View Submissions',
+ url => $url1,
+ permission => 'F',
+ icon => 'edit-find-replace.png',
+ linktitle => 'Start the process of hand grading submissions.'
+ },
+ { linktext => 'Upload Scores',
+ url => $url2,
+ permission => 'F',
+ icon => 'uploadscores.png',
+ linktitle => 'Specify a file containing the class scores for current resource.'
+ },
+ { linktext => 'Process Clicker',
+ url => $url3,
+ permission => 'F',
+ icon => 'addClickerInfoFile.png',
+ linktitle => 'Specify a file containing the clicker information for this resource.'
+ },
+ { linktext => 'Grade/Manage/Review Scantron Forms',
+ url => $url4,
+ permission => 'F',
+ icon => 'stat.png',
+ linktitle => 'Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.'
+ }
+ ]
+ });
+
+ #$fields{'command'} = 'verify';
+ #$url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
#
# Create the menu
my $Str;
@@ -8212,24 +8052,15 @@ sub grading_menu {
''."\n".
''."\n";
- foreach my $menudata (@menu) {
- if ($menudata->{'name'} ne &mt('Verify Receipt')) {
- $Str .='