diff options
-rw-r--r-- | staticweb/index.html | 42 | ||||
-rwxr-xr-x | staticweb/index.pl | 15 |
2 files changed, 44 insertions, 13 deletions
diff --git a/staticweb/index.html b/staticweb/index.html index 45372764..6ad6e831 100644 --- a/staticweb/index.html +++ b/staticweb/index.html @@ -5,18 +5,38 @@ </td></tr> <tr><td> -<a href="http://man.ptt.cc[% IF gb %]/?gb=1[% END %]">[% IF gb %]批踢踢实业坊之精华区[% ELSE %]у金金龟穨ぇ弘地跋[% END %](experimental)</a><br /> -<br /> -[% FOREACH x=dat %] -[% IF x.0 == -1 %] - <a href="/man.pl/[% x.1 %]/[% IF gb %]?gb=1[% END %]"> - <img src="http://images.ptt.cc/f.gif" style="border: 0;"> -[% ELSE %] - <a href="/index.pl/[% x.0 %]/[% IF gb %]?gb=1[% END %]"> - <img src="http://images.ptt.cc/folder.gif" style="border: 0;"> -[% END %] -[% x.2 %]</a><br /> +<a href="http://man.ptt.cc/index.pl/[% IF gb %]?gb=1[% END %]">[% IF gb %]批踢踢实业坊之精华区[% ELSE %]у金金龟穨ぇ弘地跋[% END %]</a> +[% FOREACH x=class %] +»<a href="/index.pl[% x.path %]">[% x.title %]</a> [% END %] +<br /> +<br /> +<table> + [% IF !isroot %] + <tr> + <td> + <img src="http://images.ptt.cc/folder.gif" style="border: 0;" /> + </td> + <td> + </td> + <td> + <a href="../">糷</a> + </td> + </tr> + [% END %] + [% FOREACH x=dat %] + <tr> + <td> + <img src="http://images.ptt.cc/[% IF x.0 == -1 %]f.gif[% ELSE %]folder.gif[% END %]" style="border: 0;" /> + </td> + <td>[% x.1 %]</td> + <td> + [% IF x.0 == -1 %]<a href="/man.pl/[% x.1 %]/[% IF gb %]?gb=1[% END %]">[% ELSE %]<a href="[% x.0 %]/[% IF gb %]?gb=1[% END %]">[% END %] + [% x.2 %]</a> + </td> + </tr> + [% END %] +</table> </td></tr> <tr><td> <hr /> diff --git a/staticweb/index.pl b/staticweb/index.pl index 6280ebd5..cb475725 100755 --- a/staticweb/index.pl +++ b/staticweb/index.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: index.pl,v 1.4 2003/07/11 10:11:24 in2 Exp $ +# $Id: index.pl,v 1.5 2003/07/15 09:07:27 in2 Exp $ use lib qw/./; use LocalVars; use CGI qw/:standard/; @@ -25,11 +25,15 @@ sub main $rh{charset} = 'big5'; } + return redirect('/index.pl/'.($rh{gb}?'?gb=1':'')) + if( $ENV{REQUEST_URI} eq '/' ); + charset(''); print header(); - ($bid) = $ENV{PATH_INFO} =~ m|^/(\d+)/$|; + ($bid) = $ENV{PATH_INFO} =~ m|.*/(\d+)/$|; $bid ||= 0; + $rh{isroot} = ($bid == 0); if( !$brd{$bid} ){ print "sorry, this bid $bid not found :("; @@ -42,6 +46,13 @@ sub main push @{$rh{dat}}, $_; } + my $path = ''; + foreach( $ENV{PATH_INFO} =~ m|(\w+)|g ){ + push @{$rh{class}}, {path => "$path/$_/", + title => $brd{"$_.title"}}; + $path .= "/$_"; + } + $tmpl = Template->new({INCLUDE_PATH => '.', ABSOLUTE => 0, RELATIVE => 0, |