version 1.2, 2023/03/23 22:53:46
|
version 1.4, 2024/12/25 14:20:19
|
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 104 sub handler {
|
Line 109 sub handler {
|
if ($env{'form.path'}) { |
if ($env{'form.path'}) { |
$relpath = $env{'form.path'}; |
$relpath = $env{'form.path'}; |
} |
} |
my @ids=&Apache::lonnet::current_machine_ids(); |
|
if (grep(/^\Q$env{'user.home'}\E$/,@ids)) { |
|
$is_home = 1; |
|
} |
|
if ($inc) { |
if ($inc) { |
map { $include->{$_} = 1; } split(/\s*,\s*/,$inc); |
map { $include->{$_} = 1; } split(/\s*,\s*/,$inc); |
} |
} |
Line 120 sub handler {
|
Line 121 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 140 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) { |