--- loncom/homework/grades.pm 2010/04/01 01:00:28 1.574.2.9
+++ loncom/homework/grades.pm 2010/01/18 17:54:26 1.590
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.574.2.9 2010/04/01 01:00:28 raeburn Exp $
+# $Id: grades.pm,v 1.590 2010/01/18 17:54:26 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -195,7 +195,8 @@ sub get_display_part {
my ($partID,$symb)=@_;
my $display=&Apache::lonnet::EXT('resource.'.$partID.'.display',$symb);
if (defined($display) and $display ne '') {
- $display.= " (id $partID )";
+ $display.= ' ('
+ .&mt('Part ID: [_1]',$partID).' )';
} else {
$display=$partID;
}
@@ -206,8 +207,6 @@ sub get_display_part {
#--- and parts and response type
sub showResourceInfo {
my ($symb,$probTitle,$checkboxes,$res_error) = @_;
- my $col=3;
- if ($checkboxes) { $col=4; }
my $result = '
'.&mt('Current Resource').': '.$probTitle.' '."\n";
my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error);
if (ref($res_error)) {
@@ -215,32 +214,41 @@ sub showResourceInfo {
return;
}
}
- $result .=''."\n";
+ $result.=&Apache::loncommon::end_data_table();
return $result,$responseType,$hdgrade,$partlist,$handgrade;
}
@@ -771,7 +779,7 @@ sub verifyreceipt {
my $title.=
''.
- &mt('Verifying Receipt No. [_1]',$receipt).
+ &mt('Verifying Receipt No. [_1]',$receipt).
' '."\n".
''.&mt('Resource: [_1]',$env{'form.probTitle'}).
' '."\n";
@@ -831,11 +839,14 @@ sub verifyreceipt {
}
}
if ($matches == 0) {
- $string = $title.&mt('No match found for the above receipt.');
+ $string = $title
+ .''
+ .&mt('No match found for the above receipt number.')
+ .'
';
} else {
$string = &jscriptNform($symb).$title.
''.
- &mt('The above receipt matches the following [numerate,_1,student].',$matches).
+ &mt('The above receipt number matches the following [quant,_1,student].',$matches).
'
'.
$header.
$contents.
@@ -982,8 +993,8 @@ LISTJAVASCRIPT
# checkall buttons
$gradeTable.=&check_script('gradesub', 'stuinfo');
$gradeTable.=' '."\n";
+ 'onclick="javascript:checkSelect(this.form.stuinfo);" '."\n".
+ 'value="'.&mt('Next').' →" /> '."\n";
$gradeTable.=&check_buttons();
my ($classlist, undef, $fullname) = &getclasslist($getsec,'1',$getgroup);
$gradeTable.= &Apache::loncommon::start_data_table().
@@ -1100,9 +1111,9 @@ LISTJAVASCRIPT
}
$gradeTable.=&Apache::loncommon::end_data_table()."\n".
- ' '."\n";
+ ' '."\n";
if ($ctr == 0) {
my $num_students=(scalar(keys(%$fullname)));
if ($num_students eq 0) {
@@ -1606,8 +1617,8 @@ INNERJS
pDoc = pWin.document;
pDoc.write("<\\/table>");
pDoc.write("<\\/td><\\/tr><\\/table> ");
- pDoc.write(" ");
- pDoc.write(" ");
+ pDoc.write(" ");
+ pDoc.write(" ");
pDoc.write("<\\/form>");
pDoc.write('$end_page_msg_central');
pDoc.close();
@@ -1680,8 +1691,8 @@ INNERJS
var hDoc = hwdWin.document;
hDoc.write("<\\/table>");
hDoc.write("<\\/td><\\/tr><\\/table> ");
- hDoc.write(" ");
- hDoc.write(" ");
+ hDoc.write(" ");
+ hDoc.write(" ");
hDoc.write("<\\/form>");
hDoc.write('$end_page_highlight_central');
hDoc.close();
@@ -1700,6 +1711,25 @@ sub get_increment {
return $increment;
}
+sub gradeBox_start {
+ return (
+ &Apache::loncommon::start_data_table()
+ .&Apache::loncommon::start_data_table_header_row()
+ .''.&mt('Part').' '
+ .''.&mt('Points').' '
+ .' '
+ .''.&mt('Assign Grade').' '
+ .''.&mt('Weight').' '
+ .''.&mt('Grade Status').' '
+ .&Apache::loncommon::end_data_table_header_row()
+ );
+}
+
+sub gradeBox_end {
+ return (
+ &Apache::loncommon::end_data_table()
+ );
+}
#--- displays the grading box, used in essay type problem and grading by page/sequence
sub gradeBox {
my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_;
@@ -1719,7 +1749,7 @@ sub gradeBox {
if ($last_resets{$partid}) {
$aggtries = &get_num_tries($record,$last_resets{$partid},$partid);
}
- $result.='';
+ $result.=&Apache::loncommon::start_data_table_row();
my $ctr = 0;
my $thisweight = 0;
my $increment = &get_increment();
@@ -1727,7 +1757,7 @@ sub gradeBox {
my $radio.=''."\n";
+ ''.$display_part.' '.$radio.' '.&mt('or').' '.$line.' ';
+ $result.=&Apache::loncommon::end_data_table_row();
$result.=' '."\n".
' '."\n".
''.
- &mt('View of the problem').
- ''.
- $rendered.
- '
';
+ ''
+ .'
'.&mt('View of the problem').' '
+ .$rendered
+ .'';
$companswer=
- ''.
- $companswer.
- '
';
+ ''
+ .'
'.&mt('Correct answer').' '
+ .$companswer
+ .'';
my $result;
if ($mode eq 'both') {
- $result=$rendered.$companswer;
+ $result=$rendered.$companswer;
} elsif ($mode eq 'text') {
- $result=$rendered;
+ $result=$rendered;
} elsif ($mode eq 'answer') {
- $result=$companswer;
+ $result=$companswer;
}
- $result=''.$result.'
';
return $result;
}
@@ -2034,7 +2063,7 @@ sub submission {
$request->print(<Keyword Options:
List
-Paste Selection to List
Highlight Attribute
KEYWORDS
@@ -2079,20 +2108,17 @@ KEYWORDS
# Display student info
$request->print(($counter == 0 ? '' : ' '));
- my $result='';
-
- $result.='
-
+
ENDPICK
}
@@ -3929,7 +3959,7 @@ sub upcsvScores_form {
$upfile_select
-
+
$ignore
ENDUPFORM
@@ -3960,7 +3990,7 @@ sub csvuploadmap {
my ($i,$keyfields);
if (@records) {
my $fieldserror;
- my @fields=&csvupload_fields($symb,\$fieldserror);
+ my @fields=&csvupload_fields($symb,\$fieldserror);
if ($fieldserror) {
$request->print(&navmap_errormsg());
return;
@@ -4204,7 +4234,7 @@ LISTJAVASCRIPT
my ($titles,$symbx) = &getSymbMap($map_error);
if ($map_error) {
$request->print(&navmap_errormsg());
- return;
+ return;
}
my ($curpage) =&Apache::lonnet::decode_symb($symb);
# my ($curpage,$mapId) =&Apache::lonnet::decode_symb($symb);
@@ -4252,7 +4282,7 @@ LISTJAVASCRIPT
$result.=' '.&mt('Use CODE').': '."\n";
$result.=' '."\n";
+ 'onclick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' →" /> '."\n";
$request->print($result);
@@ -4291,7 +4321,7 @@ LISTJAVASCRIPT
}
$studentTable.=&Apache::loncommon::end_data_table()."\n";
$studentTable.=' '."\n";
+ 'onclick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' →" />'."\n";
$studentTable.=&show_grading_menu_form($symb);
$request->print($studentTable);
@@ -4469,11 +4499,13 @@ sub displayPage {
}
if (&canmodify($usec)) {
+ $studentTable.=&gradeBox_start();
foreach my $partid (@{$parts}) {
$studentTable.=&gradeBox($request,$symbx,$uname,$udom,$question,$partid,\%record);
$studentTable.=' '."\n";
$question++;
}
+ $studentTable.=&gradeBox_end();
$prob++;
}
$studentTable.='';
@@ -4482,10 +4514,11 @@ sub displayPage {
$curRes = $iterator->next();
}
- $studentTable.=''."\n".
- ' '.
- ''."\n";
+ $studentTable.=
+ ''."\n".
+ ' '.
+ ''."\n";
$studentTable.=&show_grading_menu_form($symb);
$request->print($studentTable);
@@ -4543,13 +4576,16 @@ sub displaySubByDates {
my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/)
: ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/));
- $displaySub[0].=''.&mt('Part:').' '.$display_part.' ';
- $displaySub[0].='('.&mt('ID').' '.
- $responseId.') ';
+ $displaySub[0].=''.&mt('Part: [_1]',$display_part).' '
+ .' '
+ .'('.&mt('Part ID: [_1]',$responseId).')'
+ .' '
+ .' ';
if ($$record{"$where.$partid.tries"} eq '') {
- $displaySub[0].=&mt('Trial not counted');
+ $displaySub[0].=&mt('Trial not counted');
} else {
- $displaySub[0].=&mt('Trial [_1]',
+ $displaySub[0].=&mt('Trial: [_1]',
$$record{"$where.$partid.tries"});
}
my $responseType=($isTask ? 'Task'
@@ -4560,7 +4596,8 @@ sub displaySubByDates {
&get_order($partid,$responseId,$symb,$uname,$udom,
$no_increment);
}
- $displaySub[0].=' '.
+ $displaySub[0].=''; # /nobreak
+ $displaySub[0].=' '.
&cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom).' ';
}
}
@@ -4621,6 +4658,7 @@ sub updateGradeByPage {
$request->print($result);
+
my $navmap = Apache::lonnavmaps::navmap->new();
unless (ref($navmap)) {
$request->print(&navmap_errormsg());
@@ -4770,7 +4808,7 @@ sub updateGradeByPage {
#
#-------------------------------------------------------------------
-#--------------------Bubblesheet (Scantron) Grading-----------------------------------
+#-------------------- Bubblesheet (Scantron) Grading -------------------
#
#------ start of section for handling grading by page/sequence ---------
@@ -4829,9 +4867,7 @@ the homework problem.
Returns html hidden inputs used to hold context/default values.
Arguments:
- $symb - $symb of the current resource
- $map_error - ref to scalar which will container error if
- $navmap object is unavailable in &getSymbMap().
+ $symb - $symb of the current resource
=cut
@@ -4850,7 +4886,9 @@ sub defaultFormData {
Return html dropdown of possible sequences to grade
Arguments:
- $symb - $symb of the current resource
+ $symb - $symb of the current resource
+ $map_error - ref to scalar which will container error if
+ $navmap object is unavailable in &getSymbMap().
=cut
@@ -5226,7 +5264,7 @@ sub scantron_selectphase {
'.&mt('File to upload: [_1]',' ').'
-
+
');
@@ -6757,7 +6795,7 @@ sub scantron_validate_ID {
#get scantron line setup
my %scantron_config=&get_scantron_config($env{'form.scantron_format'});
my ($scanlines,$scan_data)=&scantron_getfile();
-
+
my $nav_error;
&scantron_get_maxbubble(\$nav_error); # parse needs the bubble_lines.. array.
if ($nav_error) {
@@ -7399,7 +7437,6 @@ sub scantron_validate_doublebubble {
sub scantron_get_maxbubble {
my ($nav_error) = @_;
-
if (defined($env{'form.scantron_maxbubble'}) &&
$env{'form.scantron_maxbubble'}) {
&restore_bubble_lines();
@@ -7414,7 +7451,6 @@ sub scantron_get_maxbubble {
if (ref($nav_error)) {
$$nav_error = 1;
}
- return;
}
my $map=$navmap->getResourceByUrl($sequence);
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
@@ -7920,7 +7956,7 @@ sub scantron_upload_scantron_data {
&Apache::lonhtmlcommon::end_pick_box().'
-
+
');
return '';
@@ -8447,36 +8483,50 @@ 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 Bubblesheets'),
- 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 Bubblesheets',
+ 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;
# $Str .= ''.&mt('Please select a grading task').' ';
@@ -8488,24 +8538,15 @@ sub grading_menu {
' '."\n".
' '."\n".
' '."\n";
- foreach my $menudata (@menu) {
- if ($menudata->{'name'} ne &mt('Verify Receipt')) {
- $Str .=' \n";
- } else {
- $Str .=' {'jscript'}.
- ' onClick="javascript:checkChoice(document.forms.gradingMenu,\'5\',\'verify\')" '.
- ' /> '.
- &Apache::lonnet::recprefix($env{'request.course.id'}).
- '- ';
- }
- $Str .= ' '.(' 'x8).$menudata->{'short_description'}.
- "\n";
- }
+
+ $Str .= Apache::lonhtmlcommon::generate_menu(@menu);
+ #$menudata->{'jscript'}
+ $Str .=' '.
+ &Apache::lonnet::recprefix($env{'request.course.id'}).
+ '- ';
+
$Str .="\n";
my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box.");
$request->print(< '."\n";
$result.='
-
-
-
- '.&mt('Grade Current Resource').'
-
-
-
- '.$table.'
-
-
-
-
-
'."\n";
- if (ref($sections)) {
- foreach my $section (sort(@$sections)) {
- $result.=''.$section.' '."\n";
- }
- }
+
+ '.&mt('Grade Current Resource').'
+
+
+ '.$table.'
+
+
+
+
+
+
+ '.&mt('Sections').'
+
+ '."\n";
+ $result.= $selsec;
$result.= 'all ';
$result.='
-
-
-
-
-
- '.&Apache::lonstatistics::GroupSelect('group','multiple',5).'
-
-
-
-
-
- '.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,5,undef,'mult').'
-
-
-
-
-
-
- '.&mt('with submissions').'
- '.&mt('in grading queue').'
- '.&mt('with ungraded submissions').'
- '.&mt('with incorrect submissions').'
+
+
+
+
+ '.&mt('Groups').'
+
+ '.&Apache::lonstatistics::GroupSelect('group','multiple',5).'
+
+
+
+
+ '.&mt('Access Status').'
+
+ '.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,5,undef,'mult').'
+
+
+
+
+ '.&mt('Submission Status').'
+
+
+ '.&mt('with submissions').'
+ '.&mt('in grading queue').'
+ '.&mt('with ungraded submissions').'
+ '.&mt('with incorrect submissions').'
'.&mt('with any status').'
-
-
-
-
-
+
+
+
+
+
+
+
+
'.
&mt('Select individual students to grade and view submissions.').'
-
+
-
-
-
+
+
'.&mt('Grade Complete Folder for One Student').'
-