From: Michal Vaner Date: Thu, 21 Aug 2008 21:56:09 +0000 (+0200) Subject: Help system X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=2f55c57773fc885b3ada6a73415f9056c64e4f9f;p=pciids.git Help system Still needs links to the help and write the help texts. --- diff --git a/PciIds/Html/Handler.pm b/PciIds/Html/Handler.pm index dd996ff..24f33cf 100644 --- a/PciIds/Html/Handler.pm +++ b/PciIds/Html/Handler.pm @@ -10,7 +10,7 @@ use PciIds::Html::Debug; use PciIds::Html::Changes; use PciIds::Html::Admin; use PciIds::Html::Notifications; -use PciIds::Notifications; +use PciIds::Html::Help; use Apache2::Const qw(:common :http); $ENV{'PATH'} = ''; @@ -59,6 +59,7 @@ 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)/ ); + return getHelp( $req ) if( $req->uri() =~ /^\/help/ ); my $args = parseArgs( $req->args() ); my $action = $args->{'action'}; $action = '' unless( defined $action ); diff --git a/PciIds/Html/Help.pm b/PciIds/Html/Help.pm new file mode 100644 index 0000000..512f38e --- /dev/null +++ b/PciIds/Html/Help.pm @@ -0,0 +1,28 @@ +package PciIds::Html::Help; +use strict; +use warnings; +use PciIds::Startup; +use PciIds::Html::Util; +use Apache2::Const qw(:common :http); +use base 'Exporter'; + +our @EXPORT=qw(getHelp); + +sub getHelp($) { + my( $req ) = @_; + my( $helpname ) = ( $req->uri() =~ /^\/help\/(.*)/ ); + return NOT_FOUND if( $helpname =~ /[\/.]/ || $helpname eq '' ); + open HELP, "$directory/help/$helpname" or return NOT_FOUND; + my $head = ; + chomp $head; + genHtmlHead( $req, $head, undef ); + print "

$head

\n"; + while( defined( my $line = ) ) { + print $line; + } + close HELP; + genHtmlTail(); + return OK; +} + +1;