--- loncom/interface/lonindexer.pm 2010/08/13 13:32:36 1.208 +++ loncom/interface/lonindexer.pm 2011/10/17 12:41:30 1.211 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Directory Indexer # -# $Id: lonindexer.pm,v 1.208 2010/08/13 13:32:36 wenzelju Exp $ +# $Id: lonindexer.pm,v 1.211 2011/10/17 12:41:30 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -120,8 +120,8 @@ sub handler { my $colspan=''; $extrafield=''; - my $diropendb = - "/home/httpd/perl/tmp/$env{'user.domain'}_$env{'user.name'}_sel_res.db"; + my $diropendb = LONCAPA::tempdir() . + "$env{'user.domain'}_$env{'user.name'}_sel_res.db"; %hash = (); { my %dbfile; @@ -755,6 +755,8 @@ sub scanDir { sub get_list { my ($r,$uri)=@_; my @list=(); + my $listerror; + (my $luri = $uri) =~ s/\//_/g; if ($env{'form.updatedisplay'}) { foreach (keys %hash) { @@ -778,10 +780,20 @@ sub get_list { $hash{'dirlist_files_'.$luri} = join("\n",@list); } else { # is really a directory - @list = &Apache::lonnet::dirlist($uri); + (my $listref,$listerror) = &Apache::lonnet::dirlist($uri); + if (ref($listref) eq 'ARRAY') { + @list = @{$listref}; + } $hash{'dirlist_files_'.$luri} = join("\n",@list); $hash{'dirlist_timestamp_files_'.$luri} = time; } +#Checking for error messages associated with empty directories or inaccessible servers (See Bug 4984) + if (($listerror eq 'no_such_dir') || ($listerror eq 'no_such_host')) { + $r->print("

" . &mt("Directory does not exist."). "

"); + } elsif ($listerror eq 'con_lost') { + $r->print("

" . &mt("Directory temporarily not accessible."). "

"); + } + return @list=&match_ext($r,@list); }