version 1.661, 2011/10/11 18:04:40
|
version 1.662, 2011/10/17 12:41:34
|
Line 2905 sub handback_files {
|
Line 2905 sub handback_files {
|
&file_name_version_ext($answer_file); |
&file_name_version_ext($answer_file); |
my ($portfolio_path) = ($directory =~ /^.+$stuname\/portfolio(.*)/); |
my ($portfolio_path) = ($directory =~ /^.+$stuname\/portfolio(.*)/); |
my $getpropath = 1; |
my $getpropath = 1; |
my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$portfolio_path,$domain,$stuname,$getpropath); |
my ($dir_list,$listerror) = |
my $version = &get_next_version($answer_name, $answer_ext, \@dir_list); |
&Apache::lonnet::dirlist($portfolio_root.$portfolio_path, |
|
$domain,$stuname,$getpropath); |
|
my $version = &get_next_version($answer_name,$answer_ext,$dir_list); |
# fix file name |
# fix file name |
my ($save_file_name) = (($directory.$answer_name.".$version.".$answer_ext) =~ /^.+\/${stuname}\/(.*)/); |
my ($save_file_name) = (($directory.$answer_name.".$version.".$answer_ext) =~ /^.+\/${stuname}\/(.*)/); |
my $result=&Apache::lonnet::finishuserfileupload($stuname,$domain, |
my $result=&Apache::lonnet::finishuserfileupload($stuname,$domain, |
Line 3067 sub version_portfiles {
|
Line 3069 sub version_portfiles {
|
my ($answer_name,$answer_ver,$answer_ext) = |
my ($answer_name,$answer_ver,$answer_ext) = |
&file_name_version_ext($answer_file); |
&file_name_version_ext($answer_file); |
my $getpropath = 1; |
my $getpropath = 1; |
my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$directory,$domain,$stu_name,$getpropath); |
my ($dir_list,$listerror) = |
my $version = &get_next_version($answer_name, $answer_ext, \@dir_list); |
&Apache::lonnet::dirlist($portfolio_root.$directory,$domain, |
|
$stu_name,$getpropath); |
|
my $version = &get_next_version($answer_name,$answer_ext,$dir_list); |
my $new_answer = &version_selected_portfile($domain, $stu_name, $directory, $answer_file, $version); |
my $new_answer = &version_selected_portfile($domain, $stu_name, $directory, $answer_file, $version); |
if ($new_answer ne 'problem getting file') { |
if ($new_answer ne 'problem getting file') { |
push(@versioned_portfiles, $directory.$new_answer); |
push(@versioned_portfiles, $directory.$new_answer); |
Line 3087 sub version_portfiles {
|
Line 3091 sub version_portfiles {
|
sub get_next_version { |
sub get_next_version { |
my ($answer_name, $answer_ext, $dir_list) = @_; |
my ($answer_name, $answer_ext, $dir_list) = @_; |
my $version; |
my $version; |
foreach my $row (@$dir_list) { |
if (ref($dir_list) eq 'ARRAY') { |
my ($file) = split(/\&/,$row,2); |
foreach my $row (@{$dir_list}) { |
my ($file_name,$file_version,$file_ext) = |
my ($file) = split(/\&/,$row,2); |
&file_name_version_ext($file); |
my ($file_name,$file_version,$file_ext) = |
if (($file_name eq $answer_name) && |
&file_name_version_ext($file); |
($file_ext eq $answer_ext)) { |
if (($file_name eq $answer_name) && |
# gets here if filename and extension match, regardless of version |
($file_ext eq $answer_ext)) { |
|
# gets here if filename and extension match, |
|
# regardless of version |
if ($file_version ne '') { |
if ($file_version ne '') { |
# a versioned file is found so save it for later |
# a versioned file is found so save it for later |
if ($file_version > $version) { |
if ($file_version > $version) { |
$version = $file_version; |
$version = $file_version; |
} |
} |
|
} |
} |
} |
} |
} |
} |
} |
$version ++; |
$version ++; |
return($version); |
return($version); |
} |
} |
Line 4999 sub scantron_filenames {
|
Line 5006 sub scantron_filenames {
|
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $getpropath = 1; |
my $getpropath = 1; |
my @files=&Apache::lonnet::dirlist('userfiles',$cdom,$cname, |
my ($dirlist,$listerror) = &Apache::lonnet::dirlist('userfiles',$cdom, |
$getpropath); |
$cname,$getpropath); |
my @possiblenames; |
my @possiblenames; |
foreach my $filename (sort(@files)) { |
if (ref($dirlist) eq 'ARRAY') { |
($filename)=split(/&/,$filename); |
foreach my $filename (sort(@{$dirlist})) { |
if ($filename!~/^scantron_orig_/) { next ; } |
($filename)=split(/&/,$filename); |
$filename=~s/^scantron_orig_//; |
if ($filename!~/^scantron_orig_/) { next ; } |
push(@possiblenames,$filename); |
$filename=~s/^scantron_orig_//; |
|
push(@possiblenames,$filename); |
|
} |
} |
} |
return @possiblenames; |
return @possiblenames; |
} |
} |