X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/tgal/blobdiff_plain/83bfcbc738474703171bcff01f66ea8e44792d82..7cd805d11b686c973574dd5cab7b1cb8f907f26d:/mason/dhandler diff --git a/mason/dhandler b/mason/dhandler index 13731e1..0c834b9 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

-