#!/usr/bin/perl # ! C:\sambar44\perl\perl.exe $cats{"BCT"}="Broadcasting & Copyright"; $cats{"CON"}="Confidentiality"; $cats{"COV"}="Cover Story"; $cats{"FOI"}="Freedom of Information"; $cats{"LIB"}="Libel & Privacy"; $cats{"NEW"}="Newsgathering"; $cats{"PAH"}="Press At Home & Abroad"; $cats{"SCT"}="Prior Restraints & Secret Courts"; $cats{"LEG"}="Legislative Update"; print "Content-type: text/html\n\n"; $params = $ENV{'QUERY_STRING'}; if ($params =~ /_contents$/) { #show contents of issue ($voliss,$trash) = split("/",$ENV{'QUERY_STRING'}); &showcontents; } elsif ($params =~ /_staff$/) { #show issue's staff box } else { &showstory; } sub showstory { $in = "H"; #in header at start $magfile = "$ENV{'QUERY_STRING'}.txt"; ($voliss,$trash) = split("/",$magfile); open(INF, $magfile) || die("Couldn't open $magfile ..."); $phototext = ""; $sidetext = ""; while ($cur = ) { #print "<\!-- $cur -->\n"; if ($in eq "S") { #in story; test for end if (substr($cur,0,6) eq "

\n"; } $story = $story.$cur; } } elsif ($in eq "X") { #skip } else { #in header if (substr($cur,0,4) eq "\n"; print "\n"; print " The News Media & The Law\n"; print "<\HEAD>\n"; print "\n"; print " \n"; print " Back to: \n"; print " \n"; print " This issue's table of contents\n"; print " \n"; print " \n"; print " \n"; print " News Media and the Law home page \n"; print " \n"; print " \n"; print " RCFP Home Page\n"; print "
\n"; print "
\n"; print " \n"; print " \n"; print " \n"; print " \n"; print "
\n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print "
\n"; print " \n"; print "  $state  \n"; print " \n"; print " \n"; print " \n"; print "  The News Media & The Law\n"; print " \n"; print " \n"; print " \n"; $season = ("Winter","Spring","Summer","Fall")[$issue-1]; $year = $volume + 1976; print " $season $year (Vol. $volume, No. $issue), Page $page. \n"; print " $section \n"; print " \n"; print "
\n"; print "

 

\n"; print " \n"; print " \n"; print " $headline\n"; print " \n"; print "
\n"; if (! $subhead =~ /^\s*$/) { print " \n"; print " $subhead\n"; print " \n"; print "
\n"; } print "
\n"; $testblock = $phototext.$sidetext; if (! $testblock =~ /^\s*$/) { print " \n"; print "$phototext\n"; if (! $sidetext =~ /^\s*$/) { print "\n"; print "$sidetext\n"; print "\n"; print "\n"; } print "
Related stories:
 
 
\n"; } print " $story \n"; if (! $case =~ /^\s*$/) { print "

($case)\n"; } print "


\n"; print " $copyright
\n"; print "
\n"; print "\n"; print "\n"; } sub addphotodata($dat) { ($pfile,$pcapt,$pcred) = split("%%%",$val); $phototext = "$phototext\n\n". " \n". " \n". " Photo\n". " \n". " \n". " \n". " \n". " \n". " $pcred\n". " \n". " \n". " \n". " \n". " \n". " \n". " $pcapt\n". " \n". "

\n". " \n". "   \n". " \n"; } sub addsidedata { ($shead,$surl) = split("%%%",$val); $sidetext = "$sidetext\n\n". " \n". " \n". "
\n". " $shead\n". "
\n". " \n". " \n"; } sub showcontents { ($volume,$issue) = split(/-/,$voliss); print "\n"; print "\n"; print " The News Media & The Law\n"; print "<\HEAD>\n"; print "\n"; print " \n"; print " Back to: \n"; print " \n"; print " News Media and the Law home page \n"; print " \n"; print " \n"; print " RCFP Home Page\n"; print "
\n"; print "
\n"; print " \n"; print " \n"; print " \n"; print " \n"; open(INF, "$voliss/_contents"); $oldsect = ""; while () { $newline = $_; ($var, $val, $val2) = split(/:/,$newline); if (! $val2 =~ /^\s*$/) { #val2 not empty $val = "$val: $val2"; } chop $val; $val =~ s/^\s+//; $val =~ s/\s+$//; #test for comment if ($var eq "FILE") {$file = $val} if ($var eq "STAT") {$stat = $val} if ($var eq "SECT") {$sect = $val} if ($var eq "HEAD") {$head = $val} if ($var eq "CASE") {$case = $val} if ($var eq "SUMM") {$summ = $val} if ($newline =~ /^\s*$/) { if (length($file) > 3) { #ready to process? if ($oldsect ne $sect) { $newsect = $cats{$sect}; if (! $newsect =~ /^\s*$/) { $newsect = " $newsect"; } print " \n"; $oldsect = $sect; } print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; $file = ""; $stat = ""; $sect = ""; $head = ""; $case = ""; $summ = ""; } } } close INF; print " \n"; print "
\n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print "
\n"; print " \n"; print "  TABLE OF CONTENTS  \n"; print " \n"; print " \n"; print " \n"; print "  The News Media & The Law\n"; print " \n"; print " \n"; print " \n"; print " Vol. $volume, No. $issue\n"; print "  \n"; print " \n"; print "
\n"; print "

\n\n"; print " \n"; print "
\n"; if (-e "$voliss/art/cover.jpg") { print " \"Cover\"\n"; } $season = ("","Winter","Spring","Summer","Fall")[$issue]; $year = 1976 + $volume; open(INF, "$voliss/_contents"); $covertext = ; if ($covertext =~ /^#[cC]over:/) { $covertext = $' } else {$covertext = "" } close INF; print " \n"; print " \n"; print "

The News Media & The Law

\n"; print "

$season $year

\n"; print "

$covertext

\n"; print "
\n"; print "
\n"; print " \n"; print " In this issue:

\n"; print "



$newsect
  \n"; print " \n"; print " $stat\n"; print " \n"; print " \n"; print " \n"; print " $head\n"; if (! $summ =~ /^\s*$/) { print "
$summ\n"; } if (! $case =~ /^\s*$/) { print "
($case)\n"; } print "
\n"; print "

\n"; print " \n\n\n"; }