X-Git-Url: https://git.distorted.org.uk/~mdw/tgal/blobdiff_plain/2d66be5a7168f0d5aec9b296e1b85182c329d772..fd972456d42c0d1e5031e4d12ae2ae74384e1582:/mason/dhandler diff --git a/mason/dhandler b/mason/dhandler index de0f0a9..4676769 100755 --- a/mason/dhandler +++ b/mason/dhandler @@ -35,8 +35,8 @@ of the GNU Affero General Public License. - - "> + + "> <% $head %>\ <% $title %> @@ -67,9 +67,9 @@ Failed to find ‘<% $path |h %>’. %###------------------------------------------------------------------------- <%def .contact>\ <%perl> - unless ($r->path_info =~ m!/$!) { - $m->redirect(join_paths($SCRIPTURL, $path) . "/"); - } + unless ($r->path_info =~ m!/$!) + { $m->redirect(join_paths($SCRIPTURL, $path) . "/"); } + my $real = join_paths $IMGROOT, $path; my $url = join_paths $SCRIPTURL, $path; my ($dd, $ff, $ii) = listdir $real; @@ -82,11 +82,38 @@ Failed to find ‘<% $path |h %>’. urlencode "$SCRIPTURL/$uplink"; } (my $nosl = $path) =~ s!/$!!; + + my $size = "medthumb"; + my %tn; + my (%nd, %nf); + for my $f (@$ff) + { $tn{$f} = TrivGal::Image->new($path . $f->name)->scale($size); } + for my $d (@$dd) { + my $p = join_paths $path, $d->name; + my ($ddd, $fff, $iii); + ($ddd, $fff, $iii) = listdir join_paths $IMGROOT, $p; + $nd{$d} = @$ddd; $nf{$d} = @$fff; + DIR: for (;;) { + if (defined $iii) { + my $index = join_paths $p, $iii->name; + $tn{$d} = TrivGal::Image->new($index)->scale($size); + last DIR; + } + if (!@$ddd) { $tn{$d} = undef; last DIR; } + $p = join_paths $p, $ddd->[0]->name; + ($ddd, $fff, $iii) = listdir join_paths $IMGROOT, $p; + } + } % -<&| .html, title => "Folder " . $m->interp->apply_escapes($nosl || "[top]", "h"), +<&| .html, title => + "Folder " . $m->interp->apply_escapes($nosl || "[top]", "h"), head => $links &> -<& .breadcrumbs, what => "Folder", path => $path &> +<&| .breadcrumbs, what => "Folder", path => $path &> + + % % my $note = contents "$IMGROOT/$path/.tgal-note.html"; % if (defined $note) { @@ -97,26 +124,26 @@ Failed to find ‘<% $path |h %>’. % % if (@$dd) {

Subfolders

-