#!/usr/bin/perl use strict; use warnings; use CGI qw(-autoload ); use My::HTML::WordML2HTML; use My::HTML::Common; ## find a necessary resource -- keep in mind that this is a secure intranet. Don't try this in Public Web space. my $wordML = $ENV{'DOCUMENT_ROOT'} . '/searchFAQ/' . param('file'); do { bail("Path to Word ML file $wordML incorrect or file permissions deny execution"); exit(0); } unless -e $wordML; ## Constants ################################################################### # path to DreamWeaver Library Items - no trailing slash my $lib_path = "/usr/local/apache/htdocs/Library"; # where to find some pieces. my $section = "faq"; my $left = "newsearch.nav.lbi"; my $header = 'faq.lbi'; my $footer = 'faq.footer.lbi'; # arguments for the HTML page my $args = { js => { -src => '/scripts/phone.js' }, head => q( ), }; # some default options for the HTML template. my $opts = { maxhits => 5, rdf => { url => '/usr/local/apache/htdocs/rdf/whatsNew.rdf', full_descriptions => 1 } }; ## End Constants ############################################################### # initiate an HTML object my $html = My::HTML::Common->new($opts); ## store the page pieces # Set the page header $html->page_header( join("/", $lib_path, $section, $header) ); # set the left nav bar $html->left_navigation( join("/", $lib_path, $section, $left ) ); # Set the page footer $html->page_footer( join("/", $lib_path, $section, "faq.footer.lbi") ); # generate the main content # First, some options for the XML parser my $options = { images => $ENV{'DOCUMENT_ROOT'} . '/images/test', doc_root => $ENV{'DOCUMENT_ROOT'}, jump_depth => 3, absolute_urls => 0 }; # Next, parse the file my $c = My::HTML::WordML2HTML->new( $wordML, $options ); my $ml = $c->wordML2html(); # set the main page content to the restults $html->set_page_content( $ml->htmlBody() ); # set the page banner $html->set_page_banner( my_page_banner( 'FAQs' ) ); # generate the sidebar content an ugly hack for keeping track of user prefs... my @vis; for ( qw(qlinks ptools wnew) ) { my $c = cookie( -name=> $_ ); if ( defined $c ) { push @vis, cookie( -name=>$_ ); } else { push @vis, 1; } } # set the sidebar elements $html->set_page_sidebar( undef, \@vis ); # set the page title $args->{ title } = $ml->get_info()->{ title }; # output the page $html->html_out( $args ); exit(0); # sets an HTML element specific to this page sub my_page_banner { my $title = shift; my $banner = qq(

$title

); return $banner; }