#!/usr/local/bin/perl5 -w
# Copyright InfoMall May 1995
#
# Version 0.71 27 June 1995
# Support for relative path names added
# .71: Incorrect processing of blank lines at end of outline/processed files
# addressed
# Version 0.72 2 July 1995
# Some support for Powerpoint added
# Version 0.73 15 July 1995 Minor errors in alias corrected
# Version 0.75 3 Sept 1995 More output options -- prettyprint/usedfoilslist
# Version 0.8 5 September 95 Support for Foreign formats in mixed scripts
# Version 0.81 October 13 95 -- Abtracts can be in any place in foilset -- foiln syntax
# Multiple Options to let scripts override default master
# Version 0.9 October 27 enhancements to support WebFoil
# Version 0.92 July 96 Netscape 3.0 / PPT Internet Assistant / Audio Support Changes
# Version 0.99 October 97 Addons / Edit Foil / Photos Supported
#
# Program to organize multiple Persuasion(Powerpoint) foilsets under WWW
# Written by Geoffrey Fox March--May 1995
# If it looks like Fortran or C written in PERL, thats what you would expect
# for one's first PERL program.
# Can be freely used copied and distributed but NO guarantees
#
# Execute as wwwfoil.pl CONTROL SESSION
# CONTROL defines files to be read and written -- these include:
# ORIGINAL is input(outline) file from Persuasion
# PROCOPTIONS defines preferences(options)
# PROCESSED will hold processed Persuasion foils as a stream
# WWWTEMPLATE will define templates for directory of WWW material
# SCRIPT defines for multiple foilsets the selection to be used
# ALIAS lists URL's and their aliases(sort-codes) and default link names
#
# WWWDIR is directory (don't end with slash) where information to be written
# (wwwdirwritten) or stored (wwwdir)
# WWWSERVER is Web server for each foilset
#
# ABSTEMP is temporary file to hold abstract
# PERSTEMP is temporary file to hold processed foils
#
# SESSION is optional and defines a file with session parameters
#
# %displayparms holds global parameters used in templates
%displayparms = (
'imagetitle','','htmltitle','','imagetitleset','','htmltitleset','',
'abstractimagetitle','','abstracthtmltitle','','editwbdbutton','',
'helpbutton','','upbutton','','indexbutton','','downbutton','','startbutton','','morebutton','',
'urlbutton','','framedurlbutton','',
'fullaliasbutton','','usedaliasbutton','','fullhtmlbutton','','printingbutton','','titleonlybutton','','fullhtmlbutton','',
'addonbutton','','audiodownloadbutton','','audioserverbutton','','searchbutton','',
'indexaddonbutton','','noindexaddonbutton','','indexaudiobutton','','noindexaudiobutton','',
'html1button','','html2button','','html4button','','alignimagebutton','','alignbuttonsbutton','',
'indexhtml1button','','indexhtml2button','','indexhtml4button','',
'focushtml1button','','focushtml2button','','focushtml4button','',
'indexfocushtml1button','','indexfocushtml2button','','indexfocushtml4button','',
'image1button','','image2button','','image3button','','image4button','',
'indeximage1button','','indeximage2button','','indeximage3button','','indeximage4button','',
'focusimage1button','','focusimage2button','','focusimage3button','','focusimage4button','',
'indexfocusimage1button','','indexfocusimage2button','','indexfocusimage3button','','indexfocusimage4button','',
'absimage1button','','absimage2button','','absimage3button','','absimage4button','',
'focusabsimage1button','','focusabsimage2button','','focusabsimage3button','','focusabsimage4button','',
'editsetbutton','','addonsummarybutton','',
'wisdomtabletag','','wisdomtabletdtag','','wisdomoption','',
'wisdomprotect','',
'scriptaddon','','audioline','','addonline','','targetvalue','',
"browser",'default');
#
%controlvocab =
( "procoptions",0,"moreprocoptions",0,"original",0,"processed",0,"label",0,"name",0,"load",2,
"abstract",0,"abstractsource",0,"master",1,"wwwtemplate",0,"wwwserver",0,"wwwdir",0,"makelink",0,"relative",0,
"editfile",0,"script",0,"contd",0,"wwwdirwritten",0,"foreign",0,"comment",1001);
#
%scriptvocab =
( "title",101,"bullet1",102,"bullet2",103,"bullet3",103,"bullet4",104,
"htmlline",100,"contd",0,"html",25,"endhtml",23,"foils",110,"foil",110,"url",111);
#
%procoptvocab =
( "criticalmissing",0,"somemissing",0,"seealso",0,"nogifversion",0,"noimageversion",0,
"author",0, "date",0,,"datemod",0,"event",0,"source",0,
"abstractsource",0,"addsource",0,"blanks",0,"contd",0,"powerpoint",0,
"bulletsongif",0,"bestfoilseturl",0,"name",0,"label",0,
"runningtitle",0,"titleset",0,"signature",0,"html",0,"endhtml",0);
#
%datavocab =
("abstract",22,"author",21,"beginfoil",1,"name",19,"label",20,
"bullet1",102,"bullet2",103,"bullet3",104,"bullet4",105,
"contd",0,"date",27,"datemod",28,"endfoil",99,"endhtml",23,
"event",24,"html",25,"htmlline",2,"criticalmissing",3,"somemissing",4,
"nogifversion",5,"getgiffrom",7,"runningtitle",100,"seealso",6,"source",26,
"setimagebgfile",31,"sethtmlbgfile",32,"imagebgfile",34,"htmlbgfile",35,
"intablefontsize",36,"titlefontsize",37,"bgcolor",38,"fgcolor",39,
"htmltitlecolor",40,"intablefontcolor",41,"intablebgcolor",42,"imagetitlecolor",43,
"linkcolor",44,"vlinkcolor",45,"alinkcolor",46,"imagelinkcolor",47,"imagevlinkcolor",48,
"imagealinkcolor",49,"tablelinkcolor",50,"tablevlinkcolor",51,"tablealinkcolor",52,
"horizimagewidth",53,"horizimagestyle",54,"vertimagewidth",55,"vertimagestyle",56,
"abstracttitle",57,"abstracthtml",58,"abstractimagelocation",59,
"foilevent",60,"foildate",61,"foilauthor",62,"foildatemod",63,
"foilimagebgfile",64,"foilhtmlbgfile",65,
"foilintablefontsize",66,"foiltitlefontsize",67,"foilbgcolor",68,"foilfgcolor",69,
"foilhtmltitlecolor",70,"foilintablefontcolor",71,"foilintablebgcolor",72,"foilimagetitlecolor",73,
"foillinkcolor",74,"foilvlinkcolor",75,"foilalinkcolor",76,"foilimagelinkcolor",77,"foilimagevlinkcolor",78,
"foilimagealinkcolor",79,"foiltablelinkcolor",80,"foiltablevlinkcolor",81,"foiltablealinkcolor",82,
"foilhorizimagewidth",83,"foilhorizimagestyle",84,"foilvertimagewidth",85,"foilvertimagestyle",86,
"imagelocation",87,"imagestatus",88,"addonlines",89,"addonextra",90,"addinfo",91,
"abstractsource",92,"bulletsongif",93,"bestfoilseturl",94,
"sessionstart",201,"sessionend",202,"sessiontype",203,"sessionfoilnumber",204,"sessionname",205,"sessionuser",206,
"sessionpassword",207,"sessiontime",208,"sessionaddress",209,"sessionhost",210,
"signature",30,"title",101,"titleset",29,"getimagefrom",7,"imagelocation",7,"noimageversion",5) ;
#
%sessionvocab =
("landscape",1,"portrait",2,"contd",0,"html",0,"endhtml",0);
#
@readinoptions = ("name","label","source","runningtitle","titleset","signature","bulletsongif","bestfoilseturl","abstractsource","setimagebgfile","sethtmlbgfile","abstracttitle","abstracthtml","abstractimagelocation");
@calcoptions = ("leftpadlabel","padlabel","protectedtitleset");
@modifiedoptions = ("date","datemod","event","author","imagebgfile","htmlbgfile",
"intablefontsize","titlefontsize","bgcolor","fgcolor",
"imagelocation","imagestatus","addonlines","addonextra","addinfo",
"htmltitlecolor","intablefontcolor","intablebgcolor","imagetitlecolor",
"linkcolor","vlinkcolor","alinkcolor","imagelinkcolor","imagevlinkcolor",
"imagealinkcolor","tablelinkcolor","tablevlinkcolor","tablealinkcolor",
"horizimagewidth","horizimagestyle","vertimagewidth","vertimagestyle");
#
# Open needed temporary files
open(PERSTEMP,"+>perstemp") || die("\nSorry couldnt Create perstemp \n");
open(ABSTEMP,"+>abstemp") || die("\nSorry couldnt Create abstemp \n");
if(-e 'seporggifdir') {
symlink 'seporggifdir','seporgimagedir' unless(-e 'seporgimagedir');
}
#
# Set Today
$today= `date`;
$epochtimetoday = time;
$currentdirectory= `pwd`;
chomp($currentdirectory);
$currentdirectory =~ s%^/tmp_mnt%%; # NPAC fix -- Note difficulties with absolute filenames
$userelativefilenames=0;
#
chomp($today);
$today =~ s/\d\d:\d\d:\d\d ... //; # Today's Date
#
# Set Session Parameters
$ImageSizeOption = 1;
$imagestring_landscape ='';
$imagestring_portrait = '';
$maximageheight=0;
$maximagewidth=0;
#
# Set overall options for output routine foillineout
# $linesize is output size for lines
# $newlinetobr controls treatment of embedded newlines
# $newlinetobr=0 gives newline on output while
# $newlinetobr=1 outputs in lines
# $nonewlines=1 is used in metadata generation to avoid embedded or newlines
# $prettyprint if nonzero specifies special format option (
) for output
$linesize=80;
$newlinetobr=0;
$nonewlines=0;
$prettyprint=0;
$oldprettyprint=0;
#
&readsession($ARGV[1]) if(defined($ARGV[1]));
#
# Read First Version of Alias File for Addon and url Processing
&readalias("../wwwalias");
#
# Set current number of foilsets
$foilset_ct=0;
#
# Set %tagtestvocab, %tagoutvocab
foreach $mem (keys %datavocab) {
$tagtestvocab{ $datavocab{$mem} } = $mem;
$tagoutvocab{ $datavocab{$mem} } = "\u${mem}:" ;
}
#
# Read Control data according to controlvocab
# The following parameters define what will be in presentation
#
# $usedfoilset_ct Number of Involved foilsets
# @usedfoilsets List of involved foil sets
#
# $totalfoils_ct Number of involved foils
# @listoffoilsets For each foil the foilset it comes from
# This foilset number is pointer into total
# foilset (0..$totalfoilset_ct-1) NOT the
# current selection in
# @usedfoilsets(0..$usedfoilset_ct-1)
# @listoffoils For each foil the numeric foil number in foilset
# Note numeric foil numbers START at 1 but indices
# in @listoffoilsets/foils start at 0
# abstracts denoted as numeric foil number 0
#
# $totalscript_ct Number of involved script lines
# @typeofscriptline this is a foil if -1, additional script line
# held in $script_list/_html/_type if 1
# @indexofscriptline pointer to @listoffoils/foilsets if type -1
# else pointer to entry in
# @script_list/_html/_type
#
# ********************************************************************
#
# In much data below, there is an HTML option
# If 0, then input is assumed as ordinary text and special characters
# are converted to &..; format; if 1 no conversion is done as input
# is assumed to be HTML already
#
# $totalfoilset_ct Number of processed foilsets
#
# Below each array is labelled by foilset number running from
# 0 ... $totalfoilset_ct-1
#
# @totalfoilcount Number of foils in each foilset
#
# @abstracttitle Abstract Title
# @abstracttitle_html HTML option for abstract title
# @keeplinesperabstract Number of defining lines in abstract
# @keepabsmissingoption Missing option for abstract
# @originalabsrawimage Location of IMAGE file for abstract
#
# The following arrays are labelled by both processed foilset
# number and line number
# They define data in abstract
# $keepabslinetype[foilset index][line number] Type of line as defined
# in %datavocab
# $keepabslinehtml[foilset index][line number] HTML option
# for this line
# $keepabslineitself[foilset index][line number] Value of abstract
# data line itself
#
# There is also a set of hash arrays labelled by processed foilset
# number running from 0 .... $totalfoilset_ct
# $foilsetparms[foilset index]{"name"} Nickname to be used in
# scripts and control
# $foilsetparms[foilset index]{"usedfoilslist"} List of foils used
# $foilsetparms[foilset index]{"wwwserver"} World wide web
# server to be used
# Only necessary if not same for all sets
# $foilsetparms[foilset index]{"wwwdir"} Base directory
# (no trailing /) to be used to store foilset
# related input and output files on WWW
# $foilsetparms[foilset index]{"wwwdirwritten"} Base directory
# (no trailing /) to be used to write foilset
# related input and output files on UNIX
# $foilsetparms[foilset index]{"wwwtemplate"} Input file defining
# templates for foilset
# $foilsetparms[foilset index]{"foreign"} Define foil type --
# If non-null, "unusual" non-Persuasion format
#
# $nametofoilset{"nickname"} returns foilset index for given nickname
#
# The following arrays define the individual fils in foilset and
# are labelled by foilset index and foilnumber in foilset
# (runs from 1 to $totalfoilcount[foilset index])
#
# @foiltitle Title of foil
# @foiltitle_html HTML option for foil title
# @keeplinesperfoil Number of defining lines in foil
# @keepmissingoption Missing option for foil
# @originalfoilrawimage Location of IMAGE file for foil
#
# The following arrays are labelled by threee dimensional index
# [foilset index] [foil number] [line number]
#
# @keeplinetype Type of line defining foil(bullet,htmlline etc.)
# as defined in %datavocab
# @keeplinehtml HTML option for this line
# @keeplineitself Value of foil data line itself without key: header
#
# For each foilset the following hash arrays define overall options
# There is in each case a companion array with same name but
# _html appended which contains HTML option
# $keepoptions[foilset index]{"author"} Author
# $keepoptions[foilset index]{"date"} Date foilset prepared or given
# $keepoptions[foilset index]{"datemod"} Date foilset modified
# $keepoptions[foilset index]{"event"} Event associated with foilset
# $keepoptions[foilset index]{"source"} Source of foilset
# $keepoptions[foilset index]{"runningtitle"} Running Title
# to be used in Output
# $keepoptions[foilset index]{"titleset"} Title of foilSET
# (not individual foil)
# $keepoptions[foilset index]{"signature"} Text to be used
# at end of each HTML foil
# $keepoptions[foilset index]{"label"} Label of foilset to be
# used in output
# $keepoptions[foilset index]{"padlabel"} Right Padded label of foilset to be
# used in fixed format output
# $keepoptions[foilset index]{"leftpadlabel"} Left Padded label of foilset to be
# used in fixed format output
# $keepoptions[foilset index]{"name"} Nickname of foilset
# $keepoptions[foilset index]{"bulletsongif"} if "on" use HTML bullets on IMAGE
# versions of foils
# $keepoptions[foilset index]{"bestfoilseturl"} Best URL for foilset
#
# *******************************************************************
#
&readcontrol($ARGV[0]);
#
# Cleanup at end
close ABSTEMP;
close PERSTEMP;
#
# End Main routine *****************************************************
#
# read session Information from SESSION
sub readsession {
#
my($sessionfile)=@_;
my($curkey,$vocabmem,$reading_html,$colon,$possiblekey,$savekey,$entry,$rest,$line);
#
open(SESSION,$sessionfile) || die("\nSorry couldnt Open Session File ",$sessionfile, "\n");
#
$reading_html=0; # Initial HTML option
undef %sessionvalues;
#
$curkey='none';
while( $line= ) {
chomp($line);
$colon = index($line,":");
if ( ($line =~ /^\s/) || $colon < 0 ) {
die("\nIllegal Continuation Line", $rest,"\n") if $curkey eq 'none';
$line =~ s/^\s+/ /;
$sessionvalues{$curkey} = &join($sessionvalues{$curkey},$line);
next;
}
$possiblekey = substr($line ,0, $colon);
$possiblekey =~ s/\s+//g;
$savekey=$possiblekey;
$possiblekey =~ tr/A-Z/a-z/;
$entry = -1;
foreach $vocabmem (keys %sessionvocab) {
if( $possiblekey eq $vocabmem ) {
$entry = $sessionvocab{$vocabmem};
last;
}
}
if( $entry < 0 ) {
die("\nIllegal key Processing Options ", $possiblekey, "\n"); }
if( $possiblekey eq "html" ) {
$reading_html=1;
next;
}
if( $possiblekey eq "endhtml" ) {
$reading_html=0;
next;
}
$rest = substr($line, $colon+1);
if( $possiblekey eq "contd" ) {
if ($curkey eq 'none') {
die("\nIllegal Continuation Line", $rest,"\n"); }
if( $savekey eq "CONTD" ) {
$sessionvalues{$curkey} .= "\n" . $rest;
next;
}
$sessionvalues{$curkey} = &join($sessionvalues{$curkey},$rest);
next;
}
$sessionvalues{$possiblekey} = $rest;
$sessionvalues_html{$possiblekey} = $reading_html;
$curkey=$possiblekey;
} # End loop over input lines
#
# Process Session Data
if($sessionvalues{'landscape'}) {
$imagestring_landscape = $sessionvalues{'landscape'};
$ImageSizeOption = 1;
}
if($sessionvalues{'portrait'}) {
$imagestring_portrait = $sessionvalues{'portrait'};
$ImageSizeOption = 1;
}
for $vocabmem (keys %sessionvocab) {
next unless( $sessionvocab{$vocabmem} == 3 );
next unless( exists($sessionvalues{$vocabmem}) );
$displayparms{$vocabmem} = $sessionvalues{$vocabmem};
}
return;
close(SESSION);
#
} # end readsession
#
# Read abstract from separate file
sub readabstract {
my($inabs)=@_;
#
#
# Overall Initializations
$html=0; # HTML Conversion Option If 0 convert < > & " if 1 leave input untouched
$foilcount=0; # Number of foils read
$start=0; # if zero, no real foil stuff read yet
$pendingreadfoil=''; # Initially nothing has been read in!
$abstract_reading=1; # We are reading abstract not foils
seek $inabs,0,0;
#
while( $pendingreadfoil || ($pendingreadfoil=<$inabs>) ) {
&readfoil($inabs);
}
} # End reading abstract from a file
#
# Output Abstract as Coded File
sub outabstract {
my($outabs)=@_;
my($imageset,$ikeep,$i,$entry,$pr);
#
$currenthtmloption=0;
seek $outabs,0,0;
print $outabs "Endhtml:\n" ;
if( $pr=$foilsource[$foilset_ct] ) {
$pr= $pr . '/';
}
else {
if( ($pr=$persoptions{"addsource"}) ) {
$foilsource[$foilset_ct]=$pr;
$pr .= '/'
}
else {
$pr= ' ';
}
}
print $outabs ("Beginfoil:",$pr,"Abstract\n");
&printmiss($outabs);
$imageset=0;
#
$ikeep=0;
for($i=0; $i <= $curline ; $i++) {
next if( ($entry=$linetype[$i]) ==22 );
next if( $entry==1 );
next if( $entry==99 );
next if ( $entry >=3 && $entry <=6 );
next if $persoptions{ $tagtestvocab{$entry} };
outdata( $tagoutvocab{$entry} . $foilline[$i] , $line_html[$i],$outabs);
$keepabslinetype[$foilset_ct][$ikeep]=$entry;
$keepabslinehtml[$foilset_ct][$ikeep]=$line_html[$i];
$keepabslineitself[$foilset_ct][$ikeep]=$foilline[$i];
$ikeep++;
if($entry == 7) { # IMAGE position
$originalabsrawimage[$foilset_ct]=$foilline[$i];
$imageset=1;
}
}
if($imageset==0 && $originalabsrawimage[$foilset_ct] ) {
print $outabs "Getimagefrom:",$originalabsrawimage[$foilset_ct],"\n";
}
#
$keeplinesperabstract[$foilset_ct]= $ikeep;
$keepabsmissingoption[$foilset_ct]= $missingoption;
print $outabs "Endfoil:\n";
$abstract_option= 0;
} # End output of abstract in coded form
#
sub printmiss { # Print generalized seealso message
my($outmiss)=@_;
#
print $outmiss "Criticalmissing:" if( $missingoption==1 ) ;
print $outmiss "Somemissing:" if( $missingoption==2 ) ;
print $outmiss "Seealso:" if( $missingoption==3 ) ;
print $outmiss "Noimageversion:" if( $missingoption==4 ) ;
print $outmiss "\n";
#
} # End output of seealso/missing message
#
# read information from CONTROL
sub readcontrol {
#
my($controlfile)=@_;
my($foil1,$foilset1,$com,$test,$list,$i,$j,$k,$len,$curkey,$vocabmem,$colon,$possiblekey,$savekey,$entry,$rest,$line,$wwwtemplate,$scriptfile,$new,$old,$foilset,$seporgimagedir,$wwwserver_old,$wwwdirwritten,$newdirectory,$mode,$imagestem,$scriptedset,$restproc);
# $wwwdir is global
#
open(CONTROL,$controlfile) || die("\nSorry couldnt Open Control file ",$controlfile, "\n");
$curkey='none';
undef %controloptions;
$control_ct=0;
$scriptedset=0;
#
while( $line= ) {
chomp($line);
$colon = index($line,":");
if ( ($line =~ /^\s/) || $colon < 0 ) {
die("\nIllegal Continuation Line", $rest,"\n") if $curkey eq 'none';
$line =~ s/^\s+/ /;
$controloptions[$control_ct]{$curkey} = &join($controloptions[$control_ct]{$curkey},$line);
next;
}
$possiblekey = substr($line ,0, $colon);
$possiblekey =~ s/\s+//g;
$savekey=$possiblekey;
$possiblekey =~ tr/A-Z/a-z/;
$entry = -1;
foreach $vocabmem (keys %controlvocab) {
if( $possiblekey eq $vocabmem ) {
$entry = $controlvocab{$vocabmem};
last;
}
}
if( $entry < 0 ) {
die("\nIllegal key Control Options ", $possiblekey, "\n"); }
$rest = substr($line, $colon+1);
if( $possiblekey eq "contd" ) {
if ($curkey eq 'none') {
die("\nIllegal Continuation Line", $rest,"\n"); }
if( $savekey eq "CONTD" ) {
$controloptions[$control_ct]{$curkey} .= "\n" . $rest;
next;
}
$controloptions[$control_ct]{$curkey} = &join($controloptions[$control_ct]{$curkey},$rest);
next;
}
if($possiblekey eq 'relative') {
$userelativefilenames=1;
next;
}
++$control_ct if defined $controloptions[$control_ct]{$possiblekey};
$rest =~ s%/$%% if( $possiblekey eq 'wwwdir' || $possiblekey eq 'wwwdirwritten');
$controloptions[$control_ct]{$possiblekey} = $rest;
$curkey=$possiblekey;
$restproc = $rest;
$restproc =~ s/\s*//g;
$scriptedset=1 if(($possiblekey eq 'script') && ($restproc ne 'single') && ($restproc ne 'simple') );
#
# Read options and original file if requested
next unless $entry==2; # Load command
&EndupControlset();
} # End loop over input lines
#
# Add fakefoils to Scripted Sets
if( $scriptedset ) {
++$control_ct;
$controloptions[$control_ct]{'wwwdir'} = '../webtool/fakefoils';
$controloptions[$control_ct]{'foreign'} = 'on';
$controloptions[$control_ct]{'original'} = 'original.html';
$controloptions[$control_ct]{'wwwtemplate'} = 'perswww';
$controloptions[$control_ct]{'name'} = 'webtool/fakefoils';
$controloptions[$control_ct]{'load'} = 'load';
$controloptions[$control_ct]{'procoptions'} = 'options';
$controloptions[$control_ct]{'editfile'} = '';
&EndupControlset();
--$control_ct;
}
#
$totalfoilset_ct=$foilset_ct;
$totalcontrol_ct=$control_ct+1;
die("No foilsets defined") unless $totalfoilset_ct;
close(CONTROL);
#
# Initialize Addon streams
$addonstreamcount =1;
push(@addonstream,0);
#
# Set up foilset to label maps
$labellength=0;
for($i=0;$i<$totalfoilset_ct;$i++) {
$j=$control_setpointer[$i];
#
$test=$controloptions[$j]{"label"};
$test= "Foilset" . ($i+1) unless ($test || ( $totalfoilset_ct == 1 ));
$keepoptions[$i]{"label"}=$test;
$len=length($test);
$labellength=$len unless $labellength >= $len;
$keepoptions_html[$i]{"label"}=0;
#
$test=$controloptions[$j]{"name"};
unless($test) {
$test='Foilset'.($i+1) unless ($test=$controloptions[$j]{"label"});
}
$foilsetparms[$i]{"name"}=$test;
$test =~ tr/A-Z/a-z/;
$nametofoilset{$test}=$i;
#
$foilsetparms[$i]{"wwwserver"}=$controloptions[$j]{"wwwserver"};
$foilsetparms[$i]{"wwwdir"}=$controloptions[$j]{"wwwdir"};
$foilsetparms[$i]{"wwwdirwritten"}=$controloptions[$j]{"wwwdirwritten"};
$foilsetparms[$i]{"wwwtemplate"}=$controloptions[$j]{"wwwtemplate"};
$foilsetparms[$i]{"foreign"}=$controloptions[$j]{"foreign"};
&setupfoilsetaudio($i);
$wwwdir = $foilsetparms[$i]{"wwwdir"};
&setupfoilsetaddon($i);
}
#
# Process Scripts and then templates
for($i=0;$i<$totalcontrol_ct;$i++) {
next unless ($scriptfile=$controloptions[$i]{"script"});
$scriptfile =~ s/\s*//;
$scriptabstract=$controloptions[$i]{"abstract"};
$scriptabstract='masterabstract' unless defined($scriptabstract);
$nohtmlatall=1;
$noimagetype1=1;
$noimagetype2=1;
$noimagetype3=1;
$noimagetype4=1;
if( $scriptfile eq 'single' || $scriptfile eq 'simple' ) { # Single Simple style File
#
# Fake a simple script invoking all foils of current foilset
next unless ( (defined($j=$controloptions[$i]{"load"})) || (($i>0)&&defined($j=$controloptions[$i-1]{"load"})) );
$multi=0;
$usedfoilset_ct=1;
$usedfoilsets[0]=$j;
$masterfoilset=$j;
$wwwdir=$foilsetparms[$j]{"wwwdir"};
$wwwdirwritten=$foilsetparms[$j]{"wwwdirwritten"};
$wwwserver=$foilsetparms[$j]{"wwwserver"};
$wwwtemplate=$foilsetparms[$j]{"wwwtemplate"};
$totalfoils_ct=$totalfoilcount[$j];
$totalscript_ct=$totalfoilcount[$j];
$foilsetparms[$j]{"usedfoilslist"}='';
$scriptabsrawimage=$absrawimage[$j];
#
# Set foils to be used
for($k=0;$k<$totalfoils_ct;$k++) {
$listoffoilsets[$k]=$j; # All foils from same set
$listoffoils[$k]=$k+1; # Foil numbering starts at 1 not 0 !
$typeofscriptline[$k]= -1; # Script only has foils in it
$indexofscriptline[$k]=$k; # script index to $listoffoilsets/foils
$foilsetparms[$j]{"usedfoilslist"} .= ($k+1) . ' ';
$nohtmlatall=0 if($keepmissingoption[$j][$k+1] >1);
$noimagetype1 = 0 if($keepmissingoption[$j][$k+1] ==1);
$noimagetype2 = 0 if($keepmissingoption[$j][$k+1] ==2);
$noimagetype3 = 0 if($keepmissingoption[$j][$k+1] ==3);
$noimagetype4 = 0 if($keepmissingoption[$j][$k+1] ==4);
}
&readwwwtemplate($wwwtemplate,$wwwdir,$wwwdirwritten);
} # End case of simple script
#
# Case of complex script read from a file
else { # $scriptfile not simple
die("Cannot load and define complex script simultaneously\n") if(defined($controloptions[$i]{"load"}));
$multi=1;
$test=$controloptions[$i]{"master"};
if( defined($test)) {
$test =~ tr/A-Z/a-z/;
die("Illegal Master Foilset name ",$test,"\n") unless defined($masterfoilset=$nametofoilset{$test});
}
else {
die("Master foil set undefined\n") unless defined($masterfoilset=$controloptions[$i-1]{"load"});
}
#
# Set up directories
$wwwdir=$controloptions[$i]{"wwwdir"};
$wwwdir= '.' unless defined($wwwdir);
$controloptions[$i]{"wwwdir"}=$wwwdir;
$wwwdirwritten=$controloptions[$i]{"wwwdirwritten"};
$wwwdirwritten=$wwwdir unless defined($wwwdirwritten);
$controloptions[$i]{"wwwdirwritten"}=$wwwdirwritten;
$wwwserver=$controloptions[$i]{"wwwserver"};
#
# Define foils in foilset with script
&readscript($scriptfile,$masterfoilset);
#
# Check if legal directory
for($k=0;$k<$usedfoilset_ct;$k++) {
$foilset=$usedfoilsets[$k];
next if($wwwdirwritten ne $foilsetparms[$foilset]{"wwwdirwritten"});
$wwwserver_old=$foilsetparms[$foilset]{"wwwserver"};
next if( defined($wwwserver) && defined($wwwserver_old) && ($wwwserver ne $wwwserver_old));
die "Duplicate wwwdirwritten directories for script and foilset ",$foilset, "\n";
}
#
# Check if any point in HTML
for($j=0;$j<$totalfoils_ct;$j++) {
$foilset=$listoffoilsets[$j];
$k=$listoffoils[$j];
$nohtmlatall=0 if($keepmissingoption[$foilset][$k] >1);
$noimagetype1 = 0 if($keepmissingoption[$foilset][$k] ==1);
$noimagetype2 = 0 if($keepmissingoption[$foilset][$k] ==2);
$noimagetype3 = 0 if($keepmissingoption[$foilset][$k] ==3);
$noimagetype4 = 0 if($keepmissingoption[$foilset][$k] ==4);
}
#
# Set up Audio for a Script
&setupscriptaudio($scriptabstract,$masterfoilset);
&setupscriptaddon($scriptabstract,$masterfoilset);
#
# This does not work if different servers for foilsets
# Use local/seporgimagedir in this case to grab off original source
if($seporgimagedir=$controloptions[$i]{"makelink"}) { # Create links for foils
$seporgimagedir = 'seporgimagedir' if($seporgimagedir eq 'seporggifdir');
$seporgimagedir =~ s%/$%% ;
$newdirectory = $seporgimagedir;
$newdirectory = $wwwdirwritten . '/' . $newdirectory unless($wwwdirwritten eq '.');
unless(defined(-e $newdirectory)) {
$mode=0755;
mkdir $newdirectory,$mode;
}
else { # Delete old files if clearly safe
$com='rm '.$newdirectory.'/*';
system($com) if $seporgimagedir eq 'seporgimagedir';
}
$basedirectory = $currentdirectory . '/';
$basedirectory = '' if($userelativefilenames == 1);
for($j=0;$j<$totalfoils_ct;$j++) {
$foilset=$listoffoilsets[$j];
$k=$listoffoils[$j];
$scriptrawimage[$j+1] = '';
next if($keepmissingoption[$foilset][$k]==4);
$wwwserver_old=$foilsetparms[$foilset]{"wwwserver"};
if(defined($wwwserver_old)) {
if( $wwwserver ne $wwwserver_old ) {
print "Cannot create links between different servers for foil ",$j," between servers ",$wwwserver,' * ',$wwwserver_old,"\n" ;
next;
}
}
$old=$foilsetparms[$foilset]{"wwwdirwritten"}.'/'.$seporgimagedir . '/' .(&externalnumericlabel($k));
$imagestem = &getimagetype($old);
$old .= $imagestem;
$new= $seporgimagedir . '/' . (&externalnumericlabel($j+1));
$new = $wwwdirwritten . '/' . $new unless($wwwdirwritten eq '.');
$new .= $imagestem;
$scriptrawimage[$j+1] = $new; # Set to $old for relative address
$old= &absolutefile($old);
$new= &absolutefile($new);
if(defined(-e $new) || (-l $new) ) {
print "Didnot create ",$new," as already exists\n";
next;
}
unless(defined(-e $old) || (-l $old) ) {
print "Warning that file ",$old," does not exist\n";
}
$old = &jumpfoil($new,$old) if($userelativefilenames);
die "Cannot create Symbolic link from ",$old," to ",$new,"\n" unless symlink $old,$new;
} # End symbolic links for foils
} # End creating links for foils
else { # Set scriptrawimage anyway
die("Currently must specify makelink\n");
}
#
# Set up Abstract of script -- $scriptabstract if set explicitly, holds foil number
# (numbering starting at 1!) in mixed list
# If not set we default to abstract of master foilset
if( $scriptabstract eq 'masterabstract' ) { # Set script abstract
if( $keepabsmissingoption[$masterfoilset] < 4 ) {
$scriptabsrawimage= 'seporgimagedir/abstract';
$scriptabsrawimage .= &getimagetype( $foilsetparms[$masterfoilset]{"wwwdirwritten"} . '/'. $scriptabsrawimage);
if( -e $foilsetparms[$masterfoilset]{"wwwdirwritten"} .'/'. $scriptabsrawimage ) {
$scriptabsrawimage .= &getimagetype($foilsetparms[$masterfoilset]{"wwwdirwritten"} .'/'. $scriptabsrawimage);
}
else {
$scriptabsrawimage = '';
}
}
else {
$scriptabsrawimage = '';
}
}
else { # scriptabstract defined by Foil # in Script
$scriptabstract =~ s%^[F|f]oil%%;
die('Error in Script abstract ',$scriptabstract,"\n") if( $scriptabstract < 1 || $scriptabstract > $totalfoils_ct );
$foilset1=$listoffoilsets[$scriptabstract-1];
$foil1=$listoffoils[$scriptabstract-1];
if( $keepmissingoption[$foilset1][$foil1] < 4 ) {
$scriptabsrawimage='seporgimagedir/'. &externalnumericlabel($scriptabstract);
$scriptabsrawimage .= &getimagetype($wwwdirwritten. '/'. $scriptabsrawimage);
$abstracttitle[$masterfoilset]=$foiltitle[$foilset1][$foil1];
$abstracttitle_html[$masterfoilset]=$foiltitle_html[$foilset1][$foil1];
$abstracttitle_time[$masterfoilset]=$foiltitle_time[$foilset1][$foil1];
}
else {
$scriptabsrawimage = '';
}
}
#
# This does not work if different servers for foilsets
# Use local/seporgimagedir in this case to grab off original source
if($seporgimagedir=$controloptions[$i]{"makelink"}) { # Create links for abstract
if( $scriptabsrawimage ) {
$seporgimagedir = 'seporgimagedir' if($seporgimagedir eq 'seporggifdir');
$seporgimagedir =~ s%/$%% ;
#
# Symbolic Links for abstract
if( $scriptabstract eq 'masterabstract' ) {
$wwwserver_old=$foilsetparms[$masterfoilset]{"wwwserver"};
if(defined($wwwserver_old) && ( $wwwserver ne $wwwserver_old )) {
print "Cannot create links between different servers for abstract between servers ",$wwwserver,' * ',$wwwserver_old,"\n" ;
}
$old=$foilsetparms[$masterfoilset]{"wwwdirwritten"}.'/'.$seporgimagedir . '/abstract';
}
else { # Abstract not from master
$old= $wwwdirwritten . '/' . $scriptabsrawimage;
}
$old =~ s%\.([^/\.]*)$%%;
$imagestem = &getimagetype($old);
$old .= $imagestem;
$new= $seporgimagedir. '/abstract' . $imagestem;
$new = $wwwdirwritten . '/' . $new unless($wwwdirwritten eq '.');
$scriptabsrawimage = $new; # remove (leaving as $old) for relative addressing!
$old= &absolutefile($old);
$new= &absolutefile($new);
if(defined(-e $new) || (-l $new) ) {
print "Didnot create ",$new," as already exists\n";
}
else {
unless(defined(-e $old) || (-l $old) ) {
print "Warning that file ",$old," does not exist\n";
}
$old = &jumpfoil($new,$old) if($userelativefilenames);
die "Cannot create Symbolic link from ",$old," to ",$new,"\n" unless symlink $old,$new;
}
}
} # End creating link for abstract
$scriptrawimage[0] = $scriptabsrawimage;
#
# Set Used Foils List
for($j=0;$j<$totalfoilset_ct;$j++) {
$list= '';
for($k=0;$k <$totalfoils_ct;$k++) {
next unless $listoffoilsets[$k] == $j;
$list .= $listoffoils[$k]. ' ';
}
$foilsetparms[$j]{"usedfoilslist"}=$list;
}
#
$wwwtemplate=$controloptions[$i]{"wwwtemplate"};
&readwwwtemplate($wwwtemplate,$wwwdir,$wwwdirwritten);
} # End case of complex script
} # End loop over control sections $i
return;
#
} # end readcontrol
#
# End Up Processing a Control set ended by a Load Command
sub EndupControlset {
#
my($wwwdirwritten);
#
$wwwdir=$controloptions[$control_ct]{"wwwdir"};
$wwwdir= '.' unless defined($wwwdir);
$controloptions[$control_ct]{"wwwdir"}=$wwwdir;
$wwwdirwritten=$controloptions[$control_ct]{"wwwdirwritten"};
$wwwdirwritten=$wwwdir unless defined($wwwdirwritten);
$controloptions[$control_ct]{"wwwdirwritten"}=$wwwdirwritten;
$controloptions[$control_ct]{"load"} = $foilset_ct;
chdir $wwwdirwritten;
&readopt($controloptions[$control_ct]{"procoptions"},$controloptions[$control_ct]{"moreprocoptions"});
$controloptions[$control_ct]{"editfile"} = '' unless(defined($controloptions[$control_ct]{"editfile"}));
$controloptions[$control_ct]{"label"}=$persoptions{"label"} if($persoptions{"label"});
$controloptions[$control_ct]{"name"}=$persoptions{"name"} unless($controloptions[$control_ct]{"name"});
print "Loading set ",$foilset_ct," ",$controloptions[$control_ct]{"label"}," from ",$wwwdir,"\n";
$epochtest = 0; # No Epoch test here
&readeditfile($controloptions[$control_ct]{"editfile"},$controloptions[$control_ct]{"name"},$epochtest,0);
if( exists($controloptions[$control_ct]{"foreign"}) ) {
$controloptions[$control_ct]{"foreign"}='on' unless (defined($controloptions[$control_ct]{"foreign"}))&& ($controloptions[$control_ct]{"foreign"} ne '');
&control_readforeignfoil($controloptions[$control_ct]{"original"},$controloptions[$control_ct]{"foreign"},$controloptions[$control_ct]{"editfile"});
}
else {
$controloptions[$control_ct]{"foreign"}='';
&control_readfoil($controloptions[$control_ct]{"original"},$controloptions[$control_ct]{"processed"},$controloptions[$control_ct]{"editfile"});
}
$control_setpointer[$foilset_ct]=$control_ct;
chdir $currentdirectory;
++$foilset_ct;
++$control_ct;
return;
#
} # End EndupControlset
#
# read information from SCRIPT to join foils together
sub readscript {
#
my($scriptfile,$defaultfoilsetnumber)=@_;
my($curkey,$vocabmem,$reading_html,$colon,$possiblekey,$savekey,$entry,$rest,$line,$lasttype,$i,$j,$k,$apt,$bpt,$len);
my($url,$urltitle,$urlcomment);
#
open(SCRIPT,$scriptfile) || die("\nSorry couldnt Open Script file ",$scriptfile, "\n");
$reading_html=0; # Initial HTML option
$curkey='none';
$lasttype=0;
$script_ct=0;
undef @script_list;
undef @script_html;
undef @script_type;
#
while( $line=
Sorry you need Frames!
EOF
close(FRAMES);
open(TOPLIST,'>'.$source.$toplist) || die("Sorry Could not open ",$source.$toplist," \n");
print TOPLIST <$titletotal List for Addons