#!/usr/local/bin/perl
$file_dir = '../';
$multimedia_path = $file_dir . "/multimedia/tpl/";
$mytexas_path = $file_dir . "/mytexas/tpl/";
$ID = $ENV{'PATH_INFO'};
$full_path = $file_dir . $ID;
$head_replace = "
";
$stylesheet_replace = "<\/HEAD>";
$cite_url="/handbook/online/articles/cite/handbook/online" . $ID;
$print_url="/handbook/online/articles/print" . $ID;
# check if file exists
open (ARTICLE, $full_path) ; # || die "can't open $full_path \n" ;
print "Content-type: text/html\n\n";
while () {
# chop changed to chomp by E Hahn 12/10/2001
chomp($_);
if ($_ =~ $head_replace) {
# massage fileId
$specificArtId = substr($ID, 4, 5);
$specificArtId = lc($specificArtId);
$specificArtId =~ s/.HTML//;
if (substr($specificArtId, 4, 1) eq ".") {
$specificArtId = substr($specificArtId, 0, 3) . "0" . substr($specificArtId, 3, 1) . substr($specificArtId, 5);
}
$specificArtId = "view_head_" . $specificArtId . ".html";
if (-e "$multimedia_path$specificArtId") {
open (HEAD, "$multimedia_path$specificArtId") ;
@head = ;
close HEAD;
} else {
open (HEAD, "view-head.html") || die "can't open view-head.html\n";
@head = ;
close HEAD;
}
print "@head\n";
print "\n";
print "format this article to print
\n";
print "\n";
} elsif ($_ =~ $stylesheet_replace) {
print "\n";
print $_;
} elsif ($_ =~ $foot_replace) {
print "
\n";
# check and see if there is a my texas link article
# massage fileId
$specificArtId = substr($ID, 4, 5);
$specificArtId = lc($specificArtId);
$specificArtId =~ s/.HTML//;
if (substr($specificArtId, 4, 1) eq ".") {
$specificArtId = substr($specificArtId, 0, 3) . "0" . substr($specificArtId, 3, 1) . substr($specificArtId, 5);
}
$specificArtId = "view_foot_" . $specificArtId . ".html";
# if (-e "$mytexas_path$specificArtId") {
#
# open (MTFOOT, "$mytexas_path$specificArtId") ;
# while () {
# print "$_\n";
# }
# close MTFOOT;
#
# }
open (FOOT, "view-foot.html") || die "can't open view-foot.html\n";
while () {
$_ =~ s//$cite_url/;
print "$_\n";
}
close FOOT;
} elsif ($_ =~ "") {
next;
} else {
print "$_\n";
}
}
close (ARTICLE);