version 1.320, 2006/02/27 19:40:21
|
version 1.323, 2006/02/28 02:47:30
|
Line 1413 SUBJAVASCRIPT
|
Line 1413 SUBJAVASCRIPT
|
|
|
#--- displays the grading box, used in essay type problem and grading by page/sequence |
#--- displays the grading box, used in essay type problem and grading by page/sequence |
sub gradeBox { |
sub gradeBox { |
my ($request,$symb,$uname,$udom,$counter,$partid,$record,$respid) = @_; |
my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_; |
my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL'). |
my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL'). |
'/check.gif" height="16" border="0" />'; |
'/check.gif" height="16" border="0" />'; |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname); |
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname); |
Line 1423 sub gradeBox {
|
Line 1423 sub gradeBox {
|
my $score = ($$record{'resource.'.$partid.'.awarded'} eq '' ? |
my $score = ($$record{'resource.'.$partid.'.awarded'} eq '' ? |
'' : &compute_points($$record{'resource.'.$partid.'.awarded'},$wgt)); |
'' : &compute_points($$record{'resource.'.$partid.'.awarded'},$wgt)); |
my $result='<input type="hidden" name="WGT'.$counter.'_'.$partid.'" value="'.$wgt.'" />'."\n"; |
my $result='<input type="hidden" name="WGT'.$counter.'_'.$partid.'" value="'.$wgt.'" />'."\n"; |
$result.='<br />'.$partid.' - '.$respid.'<br />'; |
|
my $display_part=&get_display_part($partid,undef,$symb); |
my $display_part=&get_display_part($partid,undef,$symb); |
my %last_resets = &get_last_resets($symb,$env{'request.course.id'}, |
my %last_resets = &get_last_resets($symb,$env{'request.course.id'}, |
[$partid]); |
[$partid]); |
Line 1472 sub gradeBox {
|
Line 1471 sub gradeBox {
|
'<input type="hidden" name="aggtries'.$counter.'_'.$partid.'" value="'. |
'<input type="hidden" name="aggtries'.$counter.'_'.$partid.'" value="'. |
$aggtries.'" />'."\n"; |
$aggtries.'" />'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.='</td></tr></table>'."\n"; |
$result.=&handbackBox($uname,$udom,$counter,$partid,$record,$respid); |
$result.=&handback_box($symb,$uname,$udom,$counter,$partid,$record); |
return $result; |
return $result; |
} |
} |
sub handbackBox { |
|
my ($uname,$udom,$counter,$partid,$record,$respid) = @_; |
sub handback_box { |
my $files=&get_submitted_files($udom,$uname,$partid,$respid,$record); |
my ($symb,$uname,$udom,$counter,$partid,$record) = @_; |
|
my ($map,$resid,$url) = &Apache::lonnet::decode_symb($symb); |
|
my ($partlist,$handgrade,$responseType) = &response_type($url,$symb); |
|
my (@respids); |
|
foreach my $part_resp (sort(keys(%$handgrade))) { |
|
my ($part,$resp) = split(/_/,$part_resp); |
|
if ($part eq $partid) { |
|
push @respids,$resp; |
|
} |
|
} |
my $result; |
my $result; |
if (@$files) { |
foreach my $respid (@respids) { |
my $file_counter = 0; |
my $prefix = $counter.'_'.$partid.'_'.$respid.'_'; |
|
my $files=&get_submitted_files($udom,$uname,$partid,$respid,$record); |
|
next if (!@$files); |
|
my $file_counter = 1; |
foreach my $file (@$files) { |
foreach my $file (@$files) { |
$result.=' Return commented document to student. <input type="file" name="part'.$partid.'_returndoc'; |
my ($file_disp) = ($file =~ m|.+/(.+)$|); |
$result.=$file_counter.'" />'."\n"; |
$result.=&mt('Return commented version of [_1] to student.', |
$result.='<input type="hidden" name="respid" value="'.$respid.'" />'; |
'<span class="filename">'.$file_disp.'</span>'); |
$result.='<input type="hidden" name="returndocorig'.$file_counter.'" value="'.$file.'" /><br />'; |
$result.='<input type="file" name="'.$prefix.'returndoc'.$file_counter.'" />'."\n"; |
} |
$result.='<input type="hidden" name="'.$prefix.'origdoc'.$file_counter.'" value="'.$file.'" /><br />'; |
|
$file_counter++; |
|
} |
} |
} |
return $result; |
return $result; |
} |
} |
Line 1914 KEYWORDS
|
Line 1927 KEYWORDS
|
my %seen = (); |
my %seen = (); |
my @partlist; |
my @partlist; |
my @gradePartRespid; |
my @gradePartRespid; |
for my $part_resp(sort keys(%$handgrade)) { |
for my $part_resp (sort(keys(%$handgrade))) { |
my ($partid,$respid) = split(/_/, $part_resp); |
my ($partid,$respid) = split(/_/, $part_resp); |
#next if ($seen{$partid} > 0); |
next if ($seen{$partid} > 0); |
if ($seen{$partid} > 0) { |
|
$request->print(&handbackBox($uname,$udom,$counter,$partid,\%record,$respid)); |
|
next; |
|
} |
|
$seen{$partid}++; |
$seen{$partid}++; |
next if ($$handgrade{$part_resp} =~ /:no$/ && $env{'form.lastSub'} =~ /^(hdgrade)$/); |
next if ($$handgrade{$part_resp} =~ /:no$/ && $env{'form.lastSub'} =~ /^(hdgrade)$/); |
push @partlist,$partid; |
push @partlist,$partid; |
push @gradePartRespid,$partid.'.'.$respid; |
push @gradePartRespid,$partid.'.'.$respid; |
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record,$respid)); |
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); |
} |
} |
$result='<input type="hidden" name="partlist'.$counter. |
$result='<input type="hidden" name="partlist'.$counter. |
'" value="'.(join ":",@partlist).'" />'."\n"; |
'" value="'.(join ":",@partlist).'" />'."\n"; |
Line 2316 sub saveHandGrade {
|
Line 2325 sub saveHandGrade {
|
$newrecord{'resource.'.$new_part.'.regrader'}= |
$newrecord{'resource.'.$new_part.'.regrader'}= |
"$env{'user.name'}:$env{'user.domain'}"; |
"$env{'user.name'}:$env{'user.domain'}"; |
} |
} |
if ($env{'form.part'.$new_part.'_returndoc1'}) { |
my ($partlist,$handgrade,$responseType) = &response_type($url,$symb); |
# if multiple files are uploaded names will be 'returndoc2','returndoc3' |
foreach my $part_resp (sort(keys(%$handgrade))) { |
|
my ($part_id, $resp_id) = split(/_/,$part_resp); |
my $portfolio_root = &Apache::loncommon::propath($domain, |
&Apache::lonnet::logthis('form.'.$newflg.'_'.$part_resp.'_returndoc1'); |
$stuname). |
&Apache::lonnet::logthis("new part is $new_part and partid is $part_id"); |
'/userfiles/portfolio'; |
if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) { |
$request->print('<br>'.$portfolio_root.'<br>'); |
# if multiple files are uploaded names will be 'returndoc2','returndoc3' |
|
my $file_counter = 1; |
# my $result=&Apache::lonnet::userfileupload('uploaddoc','', |
while ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter}) { |
# 'portfolio'.$env{'form.currentpath'}); |
my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'.filename'}; |
|
$newrecord{"resource.$new_part.$resp_id.handback"} = $env{'form.returndocorig'.$file_counter}; |
my $file_counter = 1; |
$request->print("<br />".$fname." will be the uploaded file name"); |
my $respid = $env{'form.respid'}; |
$request->print("<font color=\"red\">Will upload document</font>".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}); |
while ($env{'form.part'.$new_part.'_returndoc'.$file_counter}) { |
$file_counter++; |
my $fname=$env{'form.returndoc'.$file_counter.'.filename'}; |
} |
$newrecord{"resource.$new_part.$respid.handback"} = $env{'form.returndocorig'.$file_counter}; |
|
$request->print("<br />".$fname." will be the uploaded file name"); |
|
$request->print("<font color=\"red\">Will upload document</font>".$env{'form.returndocorig'.$file_counter}); |
|
$file_counter++; |
|
} |
} |
} |
} |
|
|
Line 2374 sub saveHandGrade {
|
Line 2379 sub saveHandGrade {
|
} |
} |
return ('',$pts,$wgt); |
return ('',$pts,$wgt); |
} |
} |
|
|
sub get_submitted_files { |
sub get_submitted_files { |
my ($udom,$uname,$partid,$respid,$record) = @_; |
my ($udom,$uname,$partid,$respid,$record) = @_; |
my @files; |
my @files; |
Line 2388 sub get_submitted_files {
|
Line 2394 sub get_submitted_files {
|
} |
} |
return (\@files); |
return (\@files); |
} |
} |
|
|
# ----------- Provides number of tries since last reset. |
# ----------- Provides number of tries since last reset. |
sub get_num_tries { |
sub get_num_tries { |
my ($record,$last_reset,$part) = @_; |
my ($record,$last_reset,$part) = @_; |