From 66f344bd9a186f2ee8c8f4a4ec88ac6497403f69 Mon Sep 17 00:00:00 2001 From: Michal Vaner Date: Sat, 30 Aug 2008 17:07:24 +0200 Subject: [PATCH] Help index --- PciIds/Html/Handler.pm | 4 ++-- PciIds/Html/Help.pm | 2 +- PciIds/Html/Util.pm | 22 +++++++++++++++++----- help/index | 21 +++++++++++++++++++++ index.html | 1 + 5 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 help/index diff --git a/PciIds/Html/Handler.pm b/PciIds/Html/Handler.pm index f490f08..879086a 100644 --- a/PciIds/Html/Handler.pm +++ b/PciIds/Html/Handler.pm @@ -58,9 +58,9 @@ my %handlers = ( sub handler( $$ ) { my( $req, $hasSSL ) = @_; - return HTTPRedirect( $req, $req->uri()."index.html" ) if( $req->uri() eq '/' ); - return DECLINED if( $req->uri() =~ /^\/((static)\/|robots.txt|index.html)/ ); my $args = parseArgs( $req->args() ); + return HTTPRedirect( $req, $req->uri()."index.html" ) if( $req->uri() eq '/' && ( !defined $args->{'action'} || $args->{'action'} ne 'help' ) ); + return DECLINED if( $req->uri() =~ /^\/((static)\/|robots.txt|index.html)/ ); my $action = $args->{'action'}; $action = '' unless( defined $action ); my $method = $handlers{$req->method()}; diff --git a/PciIds/Html/Help.pm b/PciIds/Html/Help.pm index 8c65bad..3f869c3 100644 --- a/PciIds/Html/Help.pm +++ b/PciIds/Html/Help.pm @@ -18,7 +18,7 @@ sub getHelp( $$ ) { chomp $head; genHtmlHead( $req, $head, undef ); my $addr = PciIds::Address::new( $req->uri() ); - print "

$head (".$addr->pretty().")

\n"; + print "

$head".( defined $addr ? "(".$addr->pretty().")" : "" )."

\n"; genMenu( $req, $addr, $args, $auth, undef ); genPath( $req, $addr, 1 ); my $url = setAddrPrefix( $req->uri(), 'read' ).buildExcept( 'help', $args ).'?help='; diff --git a/PciIds/Html/Util.pm b/PciIds/Html/Util.pm index 02f1a42..37538f3 100644 --- a/PciIds/Html/Util.pm +++ b/PciIds/Html/Util.pm @@ -41,7 +41,12 @@ sub item( $$ ) { sub genCustomMenu( $$$$ ) { my( $req, $address, $args, $list ) = @_; - my $url = '/'.$address->get().buildExcept( 'action', $args ).'?action='; + my $url; + if( defined $address ) { + $url = '/'.$address->get().buildExcept( 'action', $args ).'?action='; + } else { + $url = '/read/?action='; + } print "