--- loncom/interface/loncourseauthor.pm 2023/03/23 22:53:46 1.2 +++ loncom/interface/loncourseauthor.pm 2023/03/27 18:41:04 1.3 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: loncourseauthor.pm,v 1.2 2023/03/23 22:53:46 raeburn Exp $ +# $Id: loncourseauthor.pm,v 1.3 2023/03/27 18:41:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -39,7 +39,7 @@ sub handler { my $r = shift; &Apache::loncommon::content_type($r,'application/json'); $r->send_http_header; - my ($nonemptydir,%dirhash,%filehash); + my ($nonemptydir,$addtopdir,%dirhash,%filehash); if ($env{'request.course.id'}) { if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { my ($context,$recurse,$role,$is_home,$inc,$exc,$toppath,$relpath, @@ -65,6 +65,11 @@ sub handler { if ($env{'form.nonempty'}) { $nonemptydir = 1; } + if ($env{'form.addtop'}) { + $addtopdir = 1; + } else { + $addtopdir = 0; + } my $now = time; my @ids=&Apache::lonnet::current_machine_ids(); if ($role eq 'author') { @@ -120,7 +125,7 @@ sub handler { $filehashref = \%filehash; } &Apache::lonnet::recursedirs($is_home,$recurse,$include,$exclude,$nonemptydir, - $toppath,$relpath,$dirhashref,$filehashref); + $addtopdir,$toppath,$relpath,$dirhashref,$filehashref); } } } @@ -139,8 +144,6 @@ sub handler { } else { push(@dirs,(sort { lc($a) cmp lc($b) } (keys(%dirhash)))); } - } elsif (($env{'form.role'} eq 'course') && ($env{'form.path'} eq '') && (!$env{'form.nonempty'})) { - push(@dirs,'/'); } my %files; if (%filehash) {