--- loncom/homework/grades.pm 2009/05/04 22:41:37 1.567 +++ loncom/homework/grades.pm 2009/06/06 19:36:37 1.574.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.567 2009/05/04 22:41:37 raeburn Exp $ +# $Id: grades.pm,v 1.574.2.2 2009/06/06 19:36:37 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2135,10 +2135,9 @@ KEYWORDS {'one_time' => 1}); $similar="

". - &mt('Essay is [_1]% similar to an essay by [_2] ([_3]:[_4]) in course [_5] (course id [_6]:[_7])', + &mt('Essay is [_1]% similar to an essay by [_2] in course [_3] (course id [_4]:[_5])', $osim, - &Apache::loncommon::plainname($oname,$odom), - $oname,$odom, + &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')', $old_course_desc{'description'}, $old_course_desc{'num'}, $old_course_desc{'domain'}). @@ -2297,7 +2296,7 @@ KEYWORDS ''."\n"; my $nsel = ($env{'form.NTSTU'} ne '' ? $env{'form.NTSTU'} : '1'); $ntstu =~ s/
'. &mt('Grading will take longer if you use verification.').'
'. - &mt("Alternatively, the 'Review scantron data' utility (see grading menu) can be used for all students after grading is complete.").'

'. + &mt("Alternatively, the 'Review bubblesheet data' utility (see grading menu) can be used for all students after grading is complete.").'

'. ''. ''."\n"); } else { @@ -6777,10 +6776,10 @@ sub scantron_get_correction { if ($closest > 0) { foreach my $testcode (@{$closest}) { my $checked=''; - if (!$i) { $checked=' checked="checked" '; } + if (!$i) { $checked=' checked="checked"'; } $r->print(" @@ -6791,10 +6790,10 @@ sub scantron_get_correction { } } if ($$scan_record{'scantron.CODE'}=~/\S/ ) { - my $checked; if (!$i) { $checked=' checked="checked" '; } + my $checked; if (!$i) { $checked=' checked="checked"'; } $r->print(" "); @@ -7018,7 +7017,7 @@ sub prompt_for_corrections { ($responsetype_per_response{$question-1} eq 'imageresponse') || ($responsetype_per_response{$question-1} eq 'reactionresponse') || ($responsetype_per_response{$question-1} eq 'organicresponse')) { - $r->print(&mt("Although this particular question type requires handgrading, the instructions for this question in the exam directed students to leave [quant,_1,line] blank on their scantron sheets.",$lines).'

'.&mt('A non-zero score can be assigned to the student during scantron grading by selecting a bubble in at least one line.').'
'.&mt('The score for this question will be a sum of the numeric values for the selected bubbles from each line, where A=1 point, B=2 points etc.').'
'.&mt("To assign a score of zero for this question, mark all lines as 'No bubble'.").'

'); + $r->print(&mt("Although this particular question type requires handgrading, the instructions for this question in the exam directed students to leave [quant,_1,line] blank on their bubblesheets.",$lines).'

'.&mt('A non-zero score can be assigned to the student during bubblesheet grading by selecting a bubble in at least one line.').'
'.&mt('The score for this question will be a sum of the numeric values for the selected bubbles from each line, where A=1 point, B=2 points etc.').'
'.&mt("To assign a score of zero for this question, mark all lines as 'No bubble'.").'

'); } else { $r->print(&mt("Select at most one bubble in a single line and select 'No Bubble' in all the other lines. ")."
"); } @@ -7787,37 +7786,25 @@ sub scantron_upload_scantron_data_save { return ''; } my %coursedata=&Apache::lonnet::coursedescription($env{'form.domainid'}.'_'.$env{'form.courseid'}); + my $uploadedfile; $r->print('

'.&mt("Uploading file to [_1]",$coursedata{'description'}).'

'); - my $fname=$env{'form.upfile.filename'}; - #FIXME - #copied from lonnet::userfileupload() - #make that function able to target a specified course - # Replace Windows backslashes by forward slashes - $fname=~s/\\/\//g; - # Get rid of everything but the actual filename - $fname=~s/^.*\/([^\/]+)$/$1/; - # Replace spaces by underscores - $fname=~s/\s+/\_/g; - # Replace all other weird characters by nothing - $fname=~s/[^\w\.\-]//g; - # See if there is anything left - unless ($fname) { return 'error: no uploaded file'; } - my $uploadedfile=$fname; - $fname='scantron_orig_'.$fname; if (length($env{'form.upfile'}) < 2) { - $r->print(&mt("Error: The file you attempted to upload, [_1] contained no information. Please check that you entered the correct filename.",''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"')."")); + $r->print(&mt('[_1]Error:[_2] The file you attempted to upload, [_3] contained no information. Please check that you entered the correct filename.','','',''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'')); } else { - my $result=&Apache::lonnet::finishuserfileupload($env{'form.courseid'},$env{'form.domainid'},'upfile',$fname); - if ($result =~ m|^/uploaded/|) { + my $result = + &Apache::lonnet::userfileupload('upfile','','scantron','','','', + $env{'form.courseid'},$env{'form.domainid'}); + if ($result =~ m{^/uploaded/}) { $r->print(&mt('[_1]Success:[_2] Successfully uploaded [_3] bytes of data into location: [_4]', '','',(length($env{'form.upfile'})-1), ''.$result.'')); + ($uploadedfile) = ($result =~ m{/([^/]+)$}); $r->print(&validate_uploaded_scantron_file($env{'form.domainid'}, - $env{'form.courseid'},$fname)); + $env{'form.courseid'},$uploadedfile)); } else { $r->print(&mt('[_1]Error:[_2] An error ([_3]) occurred when attempting to upload the file, [_4]', '','',$result, - ''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"')."")); + ''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'')); } } if ($symb) { @@ -8089,10 +8076,10 @@ sub checkscantron_results { } } } - $r->print('

'.&mt('Comparison of scantron data (including corrections) with corresponding submission records (most recent submission) for [quant,_1,student] ([_2] scantron lines/student).',$numstudents,$env{'form.scantron_maxbubble'}).'

'); + $r->print('

'.&mt('Comparison of bubblesheet data (including corrections) with corresponding submission records (most recent submission) for [quant,_1,student] ([_2] scantron lines/student).',$numstudents,$env{'form.scantron_maxbubble'}).'

'); $r->print('

'.&mt('Exact matches for [quant,_1,student].',$passed).'
'.&mt('Discrepancies detected for [quant,_1,student].',$failed).'

'); if ($passed) { - $r->print(&mt('Students with exact correspondence between scantron data and submissions are as follows:').'

'); + $r->print(&mt('Students with exact correspondence between bubblesheet data and submissions are as follows:').'

'); $r->print(&Apache::loncommon::start_data_table()."\n". &Apache::loncommon::start_data_table_header_row()."\n". ''.&mt('Source').''.&mt('Bubble records').''.&mt('Name').''.&mt('ID').''. @@ -8101,14 +8088,14 @@ sub checkscantron_results { &Apache::loncommon::end_data_table().'
'); } if ($failed) { - $r->print(&mt('Students with differences between scantron data and submissions are as follows:').'

'); + $r->print(&mt('Students with differences between bubblesheet data and submissions are as follows:').'

'); $r->print(&Apache::loncommon::start_data_table()."\n". &Apache::loncommon::start_data_table_header_row()."\n". ''.&mt('Source').''.&mt('Bubble records').''.&mt('Name').''.&mt('ID').''. &Apache::loncommon::end_data_table_header_row()."\n". $badstudents."\n". &Apache::loncommon::end_data_table()).'
'. - &mt('Differences can occur if submissions were modified using manual grading after a scantron grading pass.').'
'.&mt('If unexpected discrepancies were detected, it is recommended that you inspect the original scantron sheets.'); + &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); return; @@ -8291,50 +8278,36 @@ sub grading_menu { 'saveState'=>"", 'gradingMenu'=>1, 'showgrading'=>"yes"); - - my $url1 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - + 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.'), + }); $fields{'command'} = 'csvform'; - my $url2 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - + $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.')}); $fields{'command'} = 'processclicker'; - my $url3 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - + $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.')}); $fields{'command'} = 'scantron_selectphase'; - 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); - # + $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('')}); # Create the menu my $Str; # $Str .= '

'.&mt('Please select a grading task').'

'; @@ -8346,15 +8319,24 @@ sub grading_menu { ''."\n". ''."\n". ''."\n"; - - $Str .= Apache::lonhtmlcommon::generate_menu(@menu); - #$menudata->{'jscript'} - $Str .='
'. - &Apache::lonnet::recprefix($env{'request.course.id'}). - '-'; - + foreach my $menudata (@menu) { + if ($menudata->{'name'} ne &mt('Verify Receipt')) { + $Str .='

{'jscript'}. + ' href="'. + $menudata->{'url'}.'" >'. + $menudata->{'name'}."

\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 .="\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.' -
- -
- -
- - '.&mt('Sections').' - - '."\n"; + if (ref($sections)) { + foreach my $section (sort(@$sections)) { + $result.=''."\n"; + } + } $result.= '   '; $result.=' -
- -
- - '.&mt('Groups').' - - '.&Apache::lonstatistics::GroupSelect('group','multiple',5).' -
- -
- - '.&mt('Access Status').' - - '.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,5,undef,'mult').' -
- -
- - '.&mt('Submission Status').' - - + + + + - -
- -
- -
-
-
+ +
+
+
+
+
-
-
+
+

'.&mt('Grade Complete Folder for One Student').'

-
-
+
+
+
-
- +
+
+
+
+
'; $result .= &show_grading_menu_form($symb); return $result; @@ -8669,7 +8662,7 @@ sub process_clicker { my %checked; foreach my $gradingmechanism ('attendance','personnel','specific','given') { if ($env{'form.gradingmechanism'} eq $gradingmechanism) { - $checked{$gradingmechanism}="checked='checked'"; + $checked{$gradingmechanism}=' checked="checked"'; } } @@ -8733,11 +8726,11 @@ function sanitycheck() {
-
-
-
+
+
+
-
+