version 1.301, 2005/12/02 19:56:36
|
version 1.305, 2006/01/27 00:26:18
|
Line 1577 sub submission {
|
Line 1577 sub submission {
|
} |
} |
my $overRideScore = $env{'form.overRideScore'} eq '' ? 'no' : $env{'form.overRideScore'}; |
my $overRideScore = $env{'form.overRideScore'} eq '' ? 'no' : $env{'form.overRideScore'}; |
|
|
$request->print('<form action="/adm/grades" method="post" name="SCORE">'."\n". |
$request->print('<form action="/adm/grades" method="post" name="SCORE" enctype="multipart/form-data">'."\n". |
'<input type="hidden" name="command" value="handgrade" />'."\n". |
'<input type="hidden" name="command" value="handgrade" />'."\n". |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n". |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n". |
'<input type="hidden" name="Status" value="'.$env{'form.Status'}.'" />'."\n". |
'<input type="hidden" name="Status" value="'.$env{'form.Status'}.'" />'."\n". |
Line 1807 KEYWORDS
|
Line 1807 KEYWORDS
|
} |
} |
if (@files) { |
if (@files) { |
$lastsubonly.='<br /><font color="red" size="1">Like all files provided by users, this file may contain virusses</font><br />'; |
$lastsubonly.='<br /><font color="red" size="1">Like all files provided by users, this file may contain virusses</font><br />'; |
|
my $file_counter = 0; |
foreach my $file (@files) { |
foreach my $file (@files) { |
|
$file_counter ++; |
&Apache::lonnet::allowuploaded('/adm/grades',$file); |
&Apache::lonnet::allowuploaded('/adm/grades',$file); |
$lastsubonly.='<br /><a href="'.$file.'" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border=0"> '.$file.'</a>'; |
$lastsubonly.='<br /><a href="'.$file.'" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border=0"> '.$file.'</a>'; |
|
$lastsubonly.='Return commented document to student. <input type="file" name="returndoc'.$file_counter.'" />'."\n"; |
|
$lastsubonly.='<input type="hidden" name="returndocorig'.$file_counter.'" value="'.$file.'" />'; |
|
|
} |
} |
$lastsubonly.='<br />'; |
$lastsubonly.='<br />'; |
} |
} |
Line 2040 sub processHandGrade {
|
Line 2045 sub processHandGrade {
|
} |
} |
} |
} |
} |
} |
|
if ($env{'form.returndoc1'}) { |
|
# if multiple files are uploaded names will be 'returndoc2', 'returndoc3' |
|
my $file_counter = 1; |
|
while ($env{'form.returndoc'.$file_counter}) { |
|
my $fname=$env{'form.returndoc'.$file_counter.'.filename'}; |
|
$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 ++; |
|
} |
|
} |
$ctr++; |
$ctr++; |
} |
} |
} |
} |
Line 2288 sub saveHandGrade {
|
Line 2303 sub saveHandGrade {
|
"$env{'user.name'}:$env{'user.domain'}"; |
"$env{'user.name'}:$env{'user.domain'}"; |
} |
} |
# unless problem has been graded, set flag to version the submitted files |
# unless problem has been graded, set flag to version the submitted files |
unless ($record{'resource.'.$new_part.'.solved'} =~ /^correct_/ || $record{'resource.'.$new_part.'.solved'} eq 'incorrect_by_override') { |
unless ($record{'resource.'.$new_part.'.solved'} =~ /^correct_/ || |
|
$record{'resource.'.$new_part.'.solved'} eq 'incorrect_by_override' || |
|
$dropMenu eq 'reset status') |
|
{ |
push (@v_flag,$new_part); |
push (@v_flag,$new_part); |
} |
} |
} |
} |
Line 2394 sub version_portfiles {
|
Line 2412 sub version_portfiles {
|
if ($key =~ /^resource\.($version_parts)\./ && $key =~ /\.portfiles$/ ) { |
if ($key =~ /^resource\.($version_parts)\./ && $key =~ /\.portfiles$/ ) { |
my @v_portfiles; |
my @v_portfiles; |
my @portfiles = split(/,/,$$record{$key}); |
my @portfiles = split(/,/,$$record{$key}); |
&Apache::lonnet::logthis("should be unmarking and remarking $key",@portfiles); |
|
foreach my $file (@portfiles) { |
foreach my $file (@portfiles) { |
&Apache::lonnet::unmark_as_readonly($domain,$stuname,[$symb,$env{'request.course.id'}],$file); |
&Apache::lonnet::unmark_as_readonly($domain,$stuname,[$symb,$env{'request.course.id'}],$file); |
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*$)/); |
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*)$/); |
my $version = 0; |
my $version = 0; |
my @answer_file_parts = split(/\./, $answer_file); |
my ($answer_name,$answer_ver,$answer_ext) = |
|
&file_name_version_ext($answer_file); |
my @dir_list = &Apache::lonnet::dirlist($directory,$domain,$stuname,$portfolio_root); |
my @dir_list = &Apache::lonnet::dirlist($directory,$domain,$stuname,$portfolio_root); |
my @file_names; |
|
my @file_name_parts; |
|
foreach my $row (@dir_list) { |
foreach my $row (@dir_list) { |
@file_names = split(/\&/,$row,2); |
my ($file) = split(/\&/,$row,2); |
@file_name_parts = split(/\./, $file_names[0]); |
my ($file_name,$file_version,$file_ext) = |
# ($file_name_parts[scalar @file_name_parts] eq $answer_file_parts[scalar @answer_file_parts]) |
&file_name_version_ext($file); |
if (($file_name_parts[0] eq $answer_file_parts[0]) && |
if (($file_name eq $answer_name) && |
($file_name_parts[-1] eq $answer_file_parts[-1])) { |
($file_ext eq $answer_ext)) { |
# gets here if filename and extension match, regardless of version |
# gets here if filename and extension match, regardless of version |
if (scalar @file_name_parts == 3) { # a versioned file is found |
if ($file_version ne '') { |
# so save it for later |
# a versioned file is found so save it for later |
if ($file_name_parts[1] > $version) {$version = $file_name_parts[1]}; |
if ($file_version > $version) { |
|
$version = $file_version; |
|
} |
} |
} |
} |
} |
} |
} |
Line 2421 sub version_portfiles {
|
Line 2439 sub version_portfiles {
|
if($env{'form.copy'} eq '-1') { |
if($env{'form.copy'} eq '-1') { |
&Apache::lonnet::logthis('problem getting file '.$directory.$answer_file); |
&Apache::lonnet::logthis('problem getting file '.$directory.$answer_file); |
} else { |
} else { |
my $copy_result = &Apache::lonnet::finishuserfileupload($stuname,$domain,'copy', |
my $new_answer = $answer_name.'.'.$version.'.'.$answer_ext; |
'/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]); |
my $copy_result = &Apache::lonnet::finishuserfileupload( |
push(@v_portfiles, $directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]); |
$stuname,$domain,'copy', |
|
'/portfolio'.$directory.$new_answer); |
|
push(@v_portfiles, $directory.$new_answer); |
&Apache::lonnet::mark_as_readonly($domain,$stuname, |
&Apache::lonnet::mark_as_readonly($domain,$stuname, |
['/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]], |
['/portfolio'.$directory.$new_answer], |
[$symb,$env{'request.course.id'},'graded']); |
[$symb,$env{'request.course.id'},'graded']); |
} |
} |
} |
} |
Line 2433 sub version_portfiles {
|
Line 2453 sub version_portfiles {
|
} |
} |
} |
} |
return 'ok'; |
return 'ok'; |
|
} |
|
|
|
sub version_selected_portfile { |
|
my ($file_name,$domain,$stu_name) = @_; |
|
return 'ok'; |
|
} |
|
|
|
sub file_name_version_ext { |
|
my ($file)=@_; |
|
my @file_parts = split(/\./, $file); |
|
my ($name,$version,$ext); |
|
if (@file_parts > 1) { |
|
$ext=pop(@file_parts); |
|
if (@file_parts > 1 && $file_parts[-1] =~ /^\d+$/) { |
|
$version=pop(@file_parts); |
|
} |
|
$name=join('.',@file_parts); |
|
} else { |
|
$name=join('.',@file_parts); |
|
} |
|
return($name,$version,$ext); |
} |
} |
|
|
#-------------------------------------------------------------------------------------- |
#-------------------------------------------------------------------------------------- |
Line 3291 sub csvuploadoptions {
|
Line 3331 sub csvuploadoptions {
|
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<h3><font color="#339933">Uploading Class Grade Options</font></h3> |
<h3><font color="#339933">Uploading Class Grade Options</font></h3> |
<input type="hidden" name="command" value="csvuploadassign" /> |
<input type="hidden" name="command" value="csvuploadassign" /> |
|
<!-- |
<p> |
<p> |
<label> |
<label> |
<input type="checkbox" name="show_full_results" /> |
<input type="checkbox" name="show_full_results" /> |
Show a table of all changes |
Show a table of all changes |
</label> |
</label> |
</p> |
</p> |
|
--> |
<p> |
<p> |
<label> |
<label> |
<input type="checkbox" name="overwite_scores" checked="checked" /> |
<input type="checkbox" name="overwite_scores" checked="checked" /> |
Line 3415 sub csvuploadassign {
|
Line 3457 sub csvuploadassign {
|
if (! %grades) { push(@skipped,"$username:$domain no data to store"); } |
if (! %grades) { push(@skipped,"$username:$domain no data to store"); } |
$grades{"resource.regrader"}="$env{'user.name'}:$env{'user.domain'}"; |
$grades{"resource.regrader"}="$env{'user.name'}:$env{'user.domain'}"; |
# &Apache::lonnet::logthis(" storing ".(join('-',%grades))); |
# &Apache::lonnet::logthis(" storing ".(join('-',%grades))); |
&Apache::lonnet::cstore(\%grades,$symb,$env{'request.course.id'}, |
my $result=&Apache::lonnet::cstore(\%grades,$symb, |
$domain,$username); |
$env{'request.course.id'}, |
$request->print('.'); |
$domain,$username); |
|
if ($result eq 'ok') { |
|
$request->print('.'); |
|
} else { |
|
$request->print("<p> |
|
<font color='red'> |
|
Failed to store student $username\@$domain. |
|
Message when trying to store was ($result) |
|
</font> |
|
</p>" ); |
|
} |
$request->rflush(); |
$request->rflush(); |
$countdone++; |
$countdone++; |
} |
} |