--- loncom/homework/grades.pm 2006/03/03 21:50:44 1.327
+++ loncom/homework/grades.pm 2006/03/11 00:08:48 1.332
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.327 2006/03/03 21:50:44 albertel Exp $
+# $Id: grades.pm,v 1.332 2006/03/11 00:08:48 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1497,6 +1497,7 @@ sub handback_box {
sub show_problem {
my ($request,$symb,$uname,$udom,$removeform,$viewon,$mode) = @_;
my $rendered;
+ &Apache::lonxml::remember_problem_counter();
if ($mode eq 'both' or $mode eq 'text') {
$rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom,
$env{'request.course.id'});
@@ -1508,6 +1509,7 @@ sub show_problem {
}
my $companswer;
if ($mode eq 'both' or $mode eq 'answer') {
+ &Apache::lonxml::restore_problem_counter();
$companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom,
$env{'request.course.id'});
}
@@ -1594,6 +1596,7 @@ sub submission {
} elsif ($env{'form.vAns'} eq 'yes') {
$mode='answer';
}
+ &Apache::lonxml::clear_problem_counter();
$request->print(&show_problem($request,$symb,$uname,$udom,0,1,$mode));
}
@@ -1692,6 +1695,7 @@ KEYWORDS
} elsif ($env{'form.vAns'} eq 'all') {
$mode='answer';
}
+ &Apache::lonxml::clear_problem_counter();
$request->print(&show_problem($request,$symb,$uname,$udom,1,1,$mode));
}
@@ -2316,14 +2320,21 @@ sub saveHandGrade {
my ($partlist,$handgrade,$responseType) = &response_type($symb);
foreach my $part_resp (sort(keys(%$handgrade))) {
my ($part_id, $resp_id) = split(/_/,$part_resp);
- &Apache::lonnet::logthis('form.'.$newflg.'_'.$part_resp.'_returndoc1');
- &Apache::lonnet::logthis("new part is $new_part and partid is $part_id");
if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) {
# if multiple files are uploaded names will be 'returndoc2','returndoc3'
my $file_counter = 1;
while ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter}) {
my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'.filename'};
$newrecord{"resource.$new_part.$resp_id.handback"} = $env{'form.returndocorig'.$file_counter};
+ # set the filename to match the submitted file name
+ $env{'form.'.$newflg.'_'.$part_resp.'_returndoc1.filename'} = $env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter};
+ my $result=&Apache::lonnet::userfileupload($newflg.'_'.$part_resp.'_returndoc'.$file_counter,'',
+ 'portfolio',undef,undef,undef,$stuname,$domain);
+ if ($result !~ m|^/uploaded/|) {
+ $request->print(' An errror occured ('.$result.
+ ') while trying to upload '.&display_file().'
');
+ # $request->print(&done('Back'));
+ }
$request->print("
".$fname." will be the uploaded file name");
$request->print("Will upload document".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter});
$file_counter++;
@@ -3748,6 +3759,7 @@ sub displayPage {
'
Gathering neccessary info.
");$r->rflush(); #get the student pick code ready $r->print(&Apache::loncommon::studentbrowser_javascript()); - my $max_bubble=&scantron_get_maxbubble($r); + my $max_bubble=&scantron_get_maxbubble(); my $result=&scantron_form_start($max_bubble).$default_form_data; $r->print($result); @@ -5063,8 +5084,10 @@ ENDSCRIPT "&scantron_CODElist=".&Apache::lonnet::escape($env{'form.scantron_CODElist'}). "&curCODE=".&Apache::lonnet::escape($$scan_record{'scantron.CODE'}). "&scantron_selectfile=".&Apache::lonnet::escape($env{'form.scantron_selectfile'}); - $r->print(" Selected CODE is "); - $r->print("\n