--- loncom/interface/loncourseauthor.pm 2022/12/31 14:08:59 1.1 +++ 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.1 2022/12/31 14:08:59 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') { @@ -87,7 +92,7 @@ sub handler { $is_home = 1; } } - } elsif ($role =~ m{^(ca|aa)\./($match_domain)/($match_username)$}) { + } elsif ($role =~ m{^(ca|aa)\./($match_domain)/($match_username)$}) { my ($rolecode,$audom,$auname) = ($1,$2,$3); if (exists($env{"user.role.$role"})) { my ($start,$end) = split(/\./,$env{"user.role.$role"}); @@ -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); } } }