[LON-CAPA-cvs] cvs: loncom(version_2_10_X) /interface loncommon.pm
raeburn
raeburn@source.lon-capa.org
Thu, 30 Dec 2010 21:44:51 -0000
raeburn Thu Dec 30 21:44:51 2010 EDT
Modified files: (Branch: version_2_10_X)
/loncom/interface loncommon.pm
Log:
- Backport 1.991.
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.948.2.19 loncom/interface/loncommon.pm:1.948.2.20
--- loncom/interface/loncommon.pm:1.948.2.19 Thu Dec 30 21:36:49 2010
+++ loncom/interface/loncommon.pm Thu Dec 30 21:44:51 2010
@@ -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.20 2010/12/30 21:44:51 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -9101,6 +9101,11 @@
$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 @@
$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;