--- loncom/homework/grades.pm 2004/09/14 13:30:09 1.209 +++ loncom/homework/grades.pm 2004/09/27 20:59:21 1.216 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.209 2004/09/14 13:30:09 ng Exp $ +# $Id: grades.pm,v 1.216 2004/09/27 20:59:21 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -25,16 +25,7 @@ # # http://www.lon-capa.org/ # -# 2/9,2/13 Guy Albertelli -# 6/8 Gerd Kortemeyer -# 7/26 H.K. Ng -# 8/20 Gerd Kortemeyer -# Year 2002 -# June-August H.K. Ng -# Year 2003 -# February, March H.K. Ng -# July, H. K. Ng -# +### package Apache::grades; use strict; @@ -1001,6 +992,7 @@ sub sub_page_kw_js { my $request = shift; my $iconpath = $request->dir_config('lonIconsURL'); &commonJSfunctions($request); + my $nothing= &Apache::lonhtmlcommon::javascript_nothing(); $request->print(<<SUBJAVASCRIPT); <script type="text/javascript" language="javascript"> @@ -1113,7 +1105,7 @@ sub sub_page_kw_js { pWin = window.open('', 'MessageCenter', 'resizable=yes,toolbar=no,location=no,scrollbars='+scrollbar+',screenx='+xpos+',screeny='+ypos+',width=600,height='+height); pWin.focus(); pDoc = pWin.document; - pDoc.open('text/html','replace'); + pDoc.open($nothing,'replace'); pDoc.write("<html><head>"); pDoc.write("<title>Message Central</title>"); @@ -1244,7 +1236,7 @@ sub sub_page_kw_js { hwdWin = window.open('', 'KeywordHighlightCentral', 'resizeable=yes,toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx='+xpos+',screeny='+ypos); hwdWin.focus(); var hDoc = hwdWin.document; - hDoc.open('text/html','replace'); + hDoc.open($nothing,'replace'); hDoc.write("<html><head>"); hDoc.write("<title>Highlight Central</title>"); @@ -3855,7 +3847,8 @@ sub scantron_find_student { sub scantron_filter { my ($curres)=@_; - if (ref($curres) && $curres->is_problem() && !$curres->randomout) { + # randomout is dysfunctional at best for this purpose + if (ref($curres) && $curres->is_problem()) { #&& !$curres->randomout) { return 1; } return 0; @@ -4480,7 +4473,8 @@ sub scantron_validate_CODE { $line,'incorrectCODE',\%allcodes); return(1,$currentphase); } - if (exists($usedCODEs{$CODE}) && $ENV{'form.scantron_CODEunique'} + if (exists($usedCODEs{$CODE}) + && $ENV{'form.scantron_CODEunique'} eq 'yes' && !$$scan_record{'scantron.CODE_ignore_dup'}) { &scantron_get_correction($r,$i,$scan_record, \%scantron_config, @@ -4647,9 +4641,10 @@ SCANTRONFORM $form{'CODE'}=$scan_record->{'scantron.CODE'}; } my $result=&Apache::lonnet::ssi($resource->src(),%form); - + if (&Apache::loncommon::connection_aborted($r)) { last; } } $completedstudents{$uname}={'line'=>$line}; + if (&Apache::loncommon::connection_aborted($r)) { last; } } continue { &Apache::lonnet::delenv('form.counter'); &Apache::lonnet::delenv('scantron\.'); @@ -4719,7 +4714,8 @@ sub scantron_upload_scantron_data_save { } return ''; } -# $r->print("Doing upload to ".$ENV{'form.courseid'}." <br />"); + my %coursedata=&Apache::lonnet::coursedescription($ENV{'form.domainid'}.'_'.$ENV{'form.courseid'}); + $r->print("Doing upload to ".$coursedata{'description'}." <br />"); my $home=&Apache::lonnet::homeserver($ENV{'form.courseid'}, $ENV{'form.domainid'}); my $fname=$ENV{'form.upfile.filename'}; @@ -4742,17 +4738,14 @@ sub scantron_upload_scantron_data_save { $r->print("<font color='red'>Error:</font> The file you attempted to upload, <tt>".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"')."</tt>, contained no information. Please check that you entered the correct filename."); } else { my $result=&Apache::lonnet::finishuserfileupload($ENV{'form.courseid'},$ENV{'form.domainid'},$home,'upfile',$fname); -# if ($result =~ m|^/uploaded/|) { - if ($result !~ m|^/uploaded/|) { -# $r->print("<font color='green'>Success:</font> Successfully uploaded ".(length($ENV{'form.upfile'})-1)." bytes of data into location <tt>".$result."</tt>"); -# } else { + if ($result =~ m|^/uploaded/|) { + $r->print("<font color='green'>Success:</font> Successfully uploaded ".(length($ENV{'form.upfile'})-1)." bytes of data into location <tt>".$result."</tt>"); + } else { $r->print("<font color='red'>Error:</font> An error (".$result.") occurred when attempting to upload the file, <tt>".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"')."</tt>"); } } if ($symb) { -# $r->print(&show_grading_menu_form($symb,$url)); $r->print(&scantron_selectphase($r,$uploadedfile)); - } else { $r->print($doanotherupload); } @@ -5116,8 +5109,7 @@ sub send_header { sub send_footer { my ($request)= @_; - $request->print('</body>'); - $request->print(&Apache::lontexconvert::footer()); + $request->print('</body></html>'); } 1;