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 "<div class='top'>\n";
22 print "<h1>$head".( defined $addr ? " (".$addr->pretty().")" : "" )."</h1>\n";
23 genMenu( $req, $addr, $args, $auth, [ [ 'Help index', 'help', 'index' ] ] );
24 print "<div class='clear'></div></div>\n";
25 genPath( $req, $addr, 1 );
26 my $url = setAddrPrefix( $req->uri(), 'read' ).buildExcept( 'help', $args ).'?help=';
27 delete $args->{'help'};
28 my %repls = ( 'HELP_URL' => $url, 'AC_URL' => setAddrPrefix( $req->uri(), 'mods' ).buildExcept( 'action', $args ).'?action=' );
29 while( defined( my $line = <HELP> ) ) {
30 $line =~ s/\$(\w+_URL)\$/$repls{$1}/g;