version 1.2, 2023/03/23 22:53:46
|
version 1.3, 2023/03/27 18:41:04
|
Line 39 sub handler {
|
Line 39 sub handler {
|
my $r = shift; |
my $r = shift; |
&Apache::loncommon::content_type($r,'application/json'); |
&Apache::loncommon::content_type($r,'application/json'); |
$r->send_http_header; |
$r->send_http_header; |
my ($nonemptydir,%dirhash,%filehash); |
my ($nonemptydir,$addtopdir,%dirhash,%filehash); |
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { |
if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { |
my ($context,$recurse,$role,$is_home,$inc,$exc,$toppath,$relpath, |
my ($context,$recurse,$role,$is_home,$inc,$exc,$toppath,$relpath, |
Line 65 sub handler {
|
Line 65 sub handler {
|
if ($env{'form.nonempty'}) { |
if ($env{'form.nonempty'}) { |
$nonemptydir = 1; |
$nonemptydir = 1; |
} |
} |
|
if ($env{'form.addtop'}) { |
|
$addtopdir = 1; |
|
} else { |
|
$addtopdir = 0; |
|
} |
my $now = time; |
my $now = time; |
my @ids=&Apache::lonnet::current_machine_ids(); |
my @ids=&Apache::lonnet::current_machine_ids(); |
if ($role eq 'author') { |
if ($role eq 'author') { |
Line 120 sub handler {
|
Line 125 sub handler {
|
$filehashref = \%filehash; |
$filehashref = \%filehash; |
} |
} |
&Apache::lonnet::recursedirs($is_home,$recurse,$include,$exclude,$nonemptydir, |
&Apache::lonnet::recursedirs($is_home,$recurse,$include,$exclude,$nonemptydir, |
$toppath,$relpath,$dirhashref,$filehashref); |
$addtopdir,$toppath,$relpath,$dirhashref,$filehashref); |
} |
} |
} |
} |
} |
} |
Line 139 sub handler {
|
Line 144 sub handler {
|
} else { |
} else { |
push(@dirs,(sort { lc($a) cmp lc($b) } (keys(%dirhash)))); |
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; |
my %files; |
if (%filehash) { |
if (%filehash) { |