#!/usr/bin/perl
#
# File: journals.cgi
# Purpose: Provide index & links to journals files
# Author: Neal Haggard
# History: 2/21/1999 - Created - NH (based on sessions.cgi)
#
use CGI qw(:standard);
$fontface = "Verdana";
$fontsize = 3;
$intro_text = <
The following are excerpts from the journals of the individual party members.
They are incomplete, despite this chronicler's best efforts, but they should
give some glimpse into the individual's perspective of the
events as they took place.
END
journal_index( param( 'journal' ) );
sub journal_index()
{
($journal) = @_;
print header();
if( $journal )
{
$ucjournal = ucfirst $journal;
$title = $ucjournal . "'s Journal Index";
}
else
{
$title = "Campaign Journals";
}
print start_html( -title=>$title,
-background=>"../images/background/parc1.jpg",
-bgcolor=>"#F4E5C0", -text=>"#8A441D", -alink=>"#0000FF",
-vlink=>"#441F0B", -link=>"#441F0B" );
print <
END
print "\n", begin_font(2), "$title\n\n";
unless( $journal )
{
@journals = <*>;
print begin_font(), "$intro_text";
print "\n";
foreach $journal (@journals)
{
if( -d $journal )
{
$ucjournal = ucfirst $journal;
if( $ucjournal =~ /s$/ )
{
$poss = "'";
}
else
{
$poss = "'s";
}
print "- ", begin_font(),
"$ucjournal",
"$poss Journal
\n";
}
}
print " - ", begin_font(),
"Mazyfum's Journal\n";
print end_html;
exit;
}
@files = <$journal/*.html>;
foreach $file (@files)
{
if( $file !~ /entry(\d+)\.html/ )
{
next;
}
$entry = $1 - 0;
push( @entries, $entry );
$files{$entry} = $file;
}
@entries = sort int_sort @entries;
foreach $entry (@entries)
{
$file = $files{$entry};
$out = entry_string( $file );
$outstr .= "";
if( $out ne "" )
{
$outstr .= "
\n | " . begin_font() . $out
. " | \n
\n";
}
}
print begin_font(), "
";
print "Latest $out\n";
print "\n";
print "
\n
\n\n\n", end_html();
}
sub begin_font( ;$ )
{
my( $add ) = @_;
if( $add eq "" )
{
$add = 0;
}
return "";
}
sub int_sort()
{
$a > $b;
}
sub entry_string()
{
($file) = @_;
open( INFILE, $file );
@lines = ;
close( INFILE );
$found = 0;
foreach $line (@lines)
{
if( $line =~ //i )
{
$title = $line;
$title =~ s/(.*)<\/title>/$1/ig;
#print "\n";
$found = 1;
last;
}
}
if( $found )
{
return( "Entry $entry: $title" );
}
else
{
return "";
}
}