--- loncom/interface/loncommon.pm 2010/12/30 21:36:49 1.948.2.19
+++ loncom/interface/loncommon.pm 2010/12/30 21:56:28 1.948.2.21
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.948.2.19 2010/12/30 21:36:49 raeburn Exp $
+# $Id: loncommon.pm,v 1.948.2.21 2010/12/30 21:56:28 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -9091,7 +9091,7 @@ sub check_for_upload {
&mt('Unable to upload [_1]. (size = [_2] bytes)',
''.$fname.'',
$filesize).'
'.
- &mt('Either the file you uploaded was empty, or your web browser was unable to read its contents.').'
';
+ &mt('Either the file you attempted to upload was empty, or your web browser was unable to read its contents.').'
';
'';
return ('zero_bytes',$msg);
}
@@ -9101,6 +9101,11 @@ sub check_for_upload {
$getpropath);
my $found_file = 0;
my $locked_file = 0;
+ my @lockers;
+ my $navmap;
+ if ($env{'request.course.id'}) {
+ $navmap = Apache::lonnavmaps::navmap->new();
+ }
foreach my $line (@dir_list) {
my ($file_name,$rest)=split(/\&/,$line,2);
if ($file_name eq $fname){
@@ -9109,8 +9114,28 @@ sub check_for_upload {
$file_name = $group.$file_name;
}
$found_file = 1;
- if (&Apache::lonnet::is_locked($file_name,$udom,$uname) eq 'true') {
- $locked_file = 1;
+ if (&Apache::lonnet::is_locked($file_name,$udom,$uname,\@lockers) eq 'true') {
+ foreach my $lock (@lockers) {
+ if (ref($lock) eq 'ARRAY') {
+ my ($symb,$crsid) = @{$lock};
+ if ($crsid eq $env{'request.course.id'}) {
+ if (ref($navmap)) {
+ my $res = $navmap->getBySymb($symb);
+ foreach my $part (@{$res->parts()}) {
+ my ($slot_status,$slot_time,$slot_name)=$res->check_for_slot($part);
+ unless (($slot_status == $res->RESERVED) ||
+ ($slot_status == $res->RESERVED_LOCATION)) {
+ $locked_file = 1;
+ }
+ }
+ } else {
+ $locked_file = 1;
+ }
+ } else {
+ $locked_file = 1;
+ }
+ }
+ }
} else {
my @info = split(/\&/,$rest);
my $currsize = $info[6]/1000;