1 package PciIds::Html::Help;
5 use PciIds::Html::Util;
7 use Apache2::Const qw(:common :http);
10 our @EXPORT=qw(getHelp);
13 my( $req, $args, $tables, $auth ) = @_;
14 my $helpname = $args->{'help'};
15 return NOT_FOUND if( !defined $helpname || $helpname =~ /[\/.]/ || $helpname eq '' );
16 open HELP, "$directory/help/$helpname" or return NOT_FOUND;
19 genHtmlHead( $req, $head, undef );
20 my $addr = PciIds::Address::new( $req->uri() );
21 print "<h1>$head".( defined $addr ? "(".$addr->pretty().")" : "" )."</h1>\n";
22 genMenu( $req, $addr, $args, $auth, undef );
23 genPath( $req, $addr, 1 );
24 my $url = setAddrPrefix( $req->uri(), 'read' ).buildExcept( 'help', $args ).'?help=';
25 delete $args->{'help'};
26 my %repls = ( 'HELP_URL' => $url, 'AC_URL' => setAddrPrefix( $req->uri(), 'mods' ).buildExcept( 'action', $args ).'?action=' );
27 print "<div class='navigation'><ul><li><a href='${url}index'>Help index</a></ul></div>\n" if( $helpname ne 'index' );
28 while( defined( my $line = <HELP> ) ) {
29 $line =~ s/\$(\w+_URL)\$/$repls{$1}/g;