--- loncom/homework/grades.pm 2009/05/04 22:41:37 1.567 +++ loncom/homework/grades.pm 2009/05/07 15:47:06 1.570 @@ -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.570 2009/05/07 15:47:06 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -4090,7 +4090,7 @@ sub csvuploadassign { $countdone++; } } - $request->print('
'.&mt("Saved [_1] students",$countdone)."\n"); + $request->print('
'.&Apache::lonhtmlcommon::confirm_success(&mt("Saved scores for [quant,_1,student]",$countdone),$countdone==0)); if (@skipped) { $request->print('

'.&mt('Skipped Students').'

'); foreach my $student (@skipped) { $request->print("$student
\n"); } @@ -6777,10 +6777,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 +6791,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(" "); @@ -7787,37 +7787,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) { @@ -8669,7 +8657,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 +8721,11 @@ function sanitycheck() {
-
-
-
+
+
+
-
+