#!/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


$titletotal

EOF print TOPLIST "$commenttotal Null or Return to Foil or Return to Index
\n"; $addonstream[$addonstreamcount]= $counturl; ++$addonstreamcount; $addonstream[$addonstreamcount] = $oldtitletotal; ++$addonstreamcount; $addonstream[$addonstreamcount] = $commenttotal; ++$addonstreamcount; for($i=0; $i<$counturl; $i++) { my($titleprotected); ($url,$title,$comment) = &interpreturlline($listofurls[$i]); &addtostream($url,$title,$comment); $url = $urlsource . $url unless( ($url =~ m%://%) || ($url =~ m%^javascript:%i) ); $titleprotected = $title; $titleprotected =~ s/'/ /; $titleprotected =~ s/"/ /; if( $comment ) { $comment = ' (' . $comment . ')'; } print TOPLIST '' . $title . ''."$comment
\n"; } print TOPLIST "\n"; close(TOPLIST); # return ( $source . $setupframes,$titletotal,$commenttotal,$streamstart); # } # End makeaddonurl # sub addtostream { # my($iter); my($count) = $addonstreamcount; for( $iter=0; $iter<3; $iter++) { $_[$iter] = '' unless(defined($_[$iter])); } push(@addonstream,1); push(@addonstream,@_); $addonstreamcount += 4; return $count; # } # End addtostream # # Set up Script Addon for Multiple URL's by copying from Original! sub copytoscriptaddon { # my($newplace,$foilno,$localfoilno,$oldplace)=@_; my($line,$scriptedversion); # unless( $oldplace =~ 'framesaddon' ) { return $oldplace; } $scriptedversion = "${newplace}framesaddon${foilno}.html"; open(OLDVERSION,'<'.$oldplace) || die("Sorry Could not open ",$oldplace," \n"); open(SCRIPTEDVERSION,'>'.$scriptedversion) || die("Sorry Could not open ",$newplace," \n"); while( $line = ) { chomp($line); $line =~ s%Foil $localfoilno%Foil $foilno%; $line =~ s%listaddon$localfoilno%listaddon$foilno%; print SCRIPTEDVERSION $line,"\n"; } close(OLDVERSION); close(SCRIPTEDVERSION); # $oldplace =~ s/framesaddon/listaddon/; $scriptedversion = "${newplace}listaddon${foilno}.html"; open(OLDVERSION,'<'.$oldplace) || die("Sorry Could not open ",$oldplace," \n"); open(SCRIPTEDVERSION,'>'.$scriptedversion) || die("Sorry Could not open ",$newplace," \n"); while( $line = ) { chomp($line); $line =~ s%Foil $localfoilno%Foil $foilno%; $line =~ s%listaddon$localfoilno%listaddon$foilno%; print SCRIPTEDVERSION $line,"\n"; } close(OLDVERSION); close(SCRIPTEDVERSION); # return "${newplace}framesaddon${foilno}.html"; # } # End copytoscriptaddon # Return AddOn Triplet sub addonurlline { # my($source,$line) = @_; my($url,$title,$comment); # ($url,$title,$comment) = &interpreturlline($line); if($url) { $url = $source . $url unless( ($url =~ m%://%) || ($url =~ m%^javascript:%i) ); } return ($url,$title,$comment); # } # End addonurlline # sub setupscriptaddon { # my($scriptpos,$masterset)=@_; my($foil,$localwwwdir,$source,$stem,$addoninfo,$grab,$begingrab,$endgrab,$oldstem); # $localwwwdir = $wwwdir; $localwwwdir = '' if( $localwwwdir eq '.' ); # # Default to no addon $scriptabstractaddonurl=''; $scriptabstractaddonurltitle=''; $scriptabstractaddonurlcomment=''; $scriptabstractaddonstream = 0; for($foil=1; $foil<=$totalfoils_ct; $foil++ ) { $scriptaddonurl[$foil] =''; $scriptaddonurltitle[$foil] =''; $scriptaddonurlcomment[$foil] =''; $scriptaddonstream[$foil] = 0; } $stem = ''; $stem = $localwwwdir . '/' if( $localwwwdir ); $source = $stem . 'addon'; unless(-e $source) { mkdir($source,0755); } $source .= '/'; # # Set Foil addon for($foil=1; $foil<=$totalfoils_ct; $foil++ ) { $addoninfo = $source . 'foil' . $foil . '.addoninfo'; unless( -e $addoninfo ) { # Create from Constituents $foilset = $listoffoilsets[$foil-1]; $localfoil = $listoffoils[$foil-1]; if( $foiladdonurl[$foilset][$localfoil] ) { $scriptaddonurl[$foil]= ©toscriptaddon($source,$foil,$localfoil,$foiladdonurl[$foilset][$localfoil]); $scriptaddonurltitle[$foil]= $foiladdonurltitle[$foilset][$localfoil]; $scriptaddonurlcomment[$foil]= $foiladdonurlcomment[$foilset][$localfoil]; $scriptaddonstream[$foil] = &addtostream($scriptaddonurl[$foil],$scriptaddonurltitle[$foil],$scriptaddonurlcomment[$foil]); } } else { # Take what ever is set already open(ADDONINFO,'<'.$addoninfo) || die("Sorry Could not open ",$addoninfo," \n"); $totalurl =''; $counturl =0; undef @saveurl; while( $grab= ) { chomp($grab); next unless($grab); $grab =~ m%([^:]*):(.*)$% ; $begingrab=$1; $endgrab=$2; $begingrab =~ tr/A-Z/a-z/; if( $begingrab eq 'url' ) { $saveurl[$counturl] = $endgrab; ++$counturl; } if( $begingrab eq 'totalurl' ) { $totalurl = $endgrab; } } ($scriptaddonurl[$foil],$scriptaddonurltitle[$foil],$scriptaddonurlcomment[$foil],$scriptaddonstream[$foil]) = &makeaddonurl($foil,$source,$totalurl,@saveurl); close(ADDONINFO); } } # # Set Abstract Addon for Script $addoninfo = $source . 'abstract.addoninfo'; if( -e $addoninfo ) { open(ADDONINFO,'<'.$addoninfo) || die("Sorry Could not open ",$addoninfo," \n"); $totalurl =''; $counturl =0; undef @saveurl; while( $grab= ) { chomp($grab); next unless($grab); $grab =~ m%([^:]*):(.*)$% ; $begingrab=$1; $endgrab=$2; $begingrab =~ tr/A-Z/a-z/; if( $begingrab eq 'url' ) { $saveurl[$counturl] = $endgrab; ++$counturl; } if( $begingrab eq 'totalurl' ) { $totalurl = $endgrab; } } ($scriptabstractaddonurl,$scriptabstractaddonurltitle,$scriptabstractaddonurlcomment,$scriptabstractaddonstream) = &makeaddonurl('abstract',$source,$totalurl,@saveurl); close(ADDONINFO); } # else { # Try to Create Abstract Addon from master abstract if( $scriptpos eq 'masterabstract' ) { $oldstem = $foilsetparms[$masterset]{"wwwdir"} . '/'; $addoninfo = $oldstem . '/addon/abstract.addoninfo'; if(-e $addoninfo ) { open(ADDONINFO,'<'.$addoninfo) || die("Sorry Could not open ",$addoninfo," \n"); $totalurl =''; $counturl =0; undef @saveurl; while( $grab= ) { chomp($grab); next unless($grab); $grab =~ m%([^:]*):(.*)$% ; $begingrab=$1; $endgrab=$2; $begingrab =~ tr/A-Z/a-z/; if( $begingrab eq 'url' ) { $saveurl[$counturl] = $endgrab; ++$counturl; } if( $begingrab eq 'totalurl' ) { $totalurl = $endgrab; } } ($scriptabstractaddonurl,$scriptabstractaddonurltitle,$scriptabstractaddonurlcomment,$scriptabstractaddonstream) = &makeaddonurl('abstract',$source,$totalurl,@saveurl); close(ADDONINFO); } } else { # Try to Create Abstract Addon from Given Foil if( $scriptaddonurl[$scriptpos] ) { $scriptabstractaddonurl = $scriptaddonurl[$scriptpos]; $scriptabstractaddonurltitle = $scriptaddonurltitle[$scriptpos]; $scriptabstractaddonurlcomment = $scriptaddonurlcomment[$scriptpos]; $scriptabstractaddonstream = &addtostream( $scriptabstractaddonurl,$scriptabstractaddonurltitle,$scriptabstractaddonurlcomment); } } } # } # End setupscriptaddon # sub setupaddonline { # my($inputoption)=@_; my($i,$addonurl,$addonurltitle,$addonurlcomment,$iconoffset,$addonline,$addonmess); # if( $inputoption eq 'addontotal' ) { if( $multi ) { for( $i=0; $i < $totalfoils_ct; $i++ ) { return 1 if($scriptaddonurl[$i]); } return 0; } else { # Individual Foilset for( $i=1; $i <= $totalfoils_ct; $i++ ) { return 1 if($foiladdonurl[$currentfoilset][$i]); } return 0; } } if( $multi ) { # Script to be accessed if( ($looptype == 1) || ($looptype == 2) ) { # foilnumber in script $addonurl = $scriptaddonurl[$mixedfoilno]; $addonurltitle = $scriptaddonurltitle[$mixedfoilno]; $addonurlcomment = $scriptaddonurlcomment[$mixedfoilno]; } else { # Abstract in Script $addonurl = $scriptabstractaddonurl; $addonurltitle = $scriptabstractaddonurltitle; $addonurlcomment = $scriptabstractaddonurlcomment; } } else { # Individual Foilset to be accessed if( ($looptype == 1) || ($looptype == 2) ) { # foilnumber in foilset $addonurl = $foiladdonurl[$currentfoilset][$currentfoilno]; $addonurltitle = $foiladdonurltitle[$currentfoilset][$currentfoilno]; $addonurlcomment = $foiladdonurlcomment[$currentfoilset][$currentfoilno]; } else { # Abstract in Foilset $addonurl = $abstractaddonurl[$currentfoilset]; $addonurltitle = $abstractaddonurltitle[$currentfoilset]; $addonurlcomment = $abstractaddonurlcomment[$currentfoilset]; } } if( $addonurl eq '' ) { if( ($inputoption eq 'addonchar') || ($inputoption eq 'addonchar1') ) { $iconoffset = &jumpfoil($locpath,$filepath{'basedirectory'}); $valuewww{'addonline'} = ''; return 1; } $valuewww{'addonline'}=''; return 0; } $addonurl = &jumpfoil($locpath,$addonurl) if( $addonurl ); my($addalt) = $addonurltitle; $addalt ='No Title' unless($addalt); $addalt =~ s/'//g; if( $inputoption eq 'addonbuttons' ) { $iconoffset = &jumpfoil($locpath,$filepath{'basedirectory'}); $addonline=''; if( $addonurl ) { $addonmess = ' ' . (&localitem('addonbutton')); $addonmess =~ s/$addalt' . $addonmess . ' '; } } elsif( $inputoption eq 'addonchar' ) { $iconoffset = &jumpfoil($locpath,$filepath{'basedirectory'}); $addonline = ''; if( $addonurl ) { $addonline = ' ."'; $addonline = '' . $addonline. ' '; } } elsif( $inputoption eq 'addonchar1' ) { $iconoffset = &jumpfoil($locpath,$filepath{'basedirectory'}); $addonline=''; if( $addonurl ) { $addonline = ' ."'; } } else { $addonurltitle =~ s/'//g; $addonurlcomment =~ s/'//g; $addonline = $addonurl .'\',\''. $addonurltitle .'\',\''. $addonurlcomment; } $valuewww{'addonline'}=$addonline; return 1; # } # End setupaddonline # # Setup Audio Characteristics of foilset assuming these have been properly # preprocessed by setuprealaudio.pl which sets .rainfo files in audio.ra for all # single foilsets sub setupfoilsetaudio { # my($foilset)=@_; my($foil,$localwwwdir,$source,$stem,$rainfo,$grab,$begingrab,$endgrab); # $localwwwdir = $foilsetparms[$foilset]{"wwwdir"}; $localwwwdir = '' if( $localwwwdir eq '.' ); # # Default to no audio $abstractaudioraurl[$foilset]=''; $abstractaudioramurl[$foilset]=''; $abstractaudiotime[$foilset]=0; $abstractaudionull[$foilset]=1; for($foil=1; $foil<=$totalfoilcount[$foilset]; $foil++ ) { $foilaudioraurl[$foilset][$foil]=''; $foilaudioramurl[$foilset][$foil]=''; $foilaudiotime[$foilset][$foil]=0; $foilaudionull[$foilset][$foil]=1; } $stem = ''; $stem = $localwwwdir . '/' if( $localwwwdir ); $source = $stem . 'audio.ra'; return unless(-e $source); $source .= '/'; $rainfo = $source . 'abstract.rainfo'; if( -e $rainfo ) { open(RAINFO,'<'.$rainfo) || die("Sorry Could not open ",$rainfo," \n"); while( $grab= ) { $grab =~ m%([^:]*):(.*)$% ; $begingrab=$1; $endgrab=$2; $begingrab =~ tr/A-Z/a-z/; $abstractaudioraurl[$foilset]= $stem . $endgrab if( $begingrab eq 'raplace' ); $abstractaudioramurl[$foilset]= $stem . $endgrab if( $begingrab eq 'ramplace' ); $abstractaudiotime[$foilset]= $endgrab if( $begingrab eq 'seconds' ); $abstractaudionull[$foilset]=0 if( ($begingrab eq 'nullaudio') && ( $endgrab eq 'no' ) ); } close(RAINFO); } for($foil=1; $foil<=$totalfoilcount[$foilset]; $foil++ ) { $rainfo = $source . 'foil' . $foil . '.rainfo'; next unless( -e $rainfo ); open(RAINFO,'<'.$rainfo) || die("Sorry Could not open ",$rainfo," \n"); while( $grab= ) { $grab =~ m%([^:]*):(.*)$% ; $begingrab=$1; $endgrab=$2; $begingrab =~ tr/A-Z/a-z/; $foilaudioraurl[$foilset][$foil]= $stem . $endgrab if( $begingrab eq 'raplace' ); $foilaudioramurl[$foilset][$foil]= $stem . $endgrab if( $begingrab eq 'ramplace' ); $foilaudiotime[$foilset][$foil]= $endgrab if( $begingrab eq 'seconds' ); $foilaudionull[$foilset][$foil]=0 if( ($begingrab eq 'nullaudio') && ( $endgrab eq 'no' ) ); } close(RAINFO); } # } # End setupfoilsetaudio # # # Setup Audio Characteristics of Script assuming these have been properly # preprocessed by setuprealaudio.pl which sets .rainfo files in audio.ra # for those foils in script with new audio # Index of $scriptaudioraurl etc. starts at 1 not 0 # If abstract or foil rainfo not set in audio.ra, we try to create from constituent foilset! sub setupscriptaudio { # my($scriptpos,$masterset)=@_; my($foil,$localwwwdir,$source,$stem,$rainfo,$grab,$begingrab,$endgrab,$rapos,$rampos,$ramsource,$oldstem); # $localwwwdir = $wwwdir; $localwwwdir = '' if( $localwwwdir eq '.' ); # # Default to no audio $scriptabstractaudioraurl=''; $scriptabstractaudioramurl=''; $scriptabstractaudiotime=0; $scriptabstractaudionull=1; for($foil=1; $foil<=$totalfoils_ct; $foil++ ) { $scriptaudioraurl[$foil]=''; $scriptaudioramurl[$foil]=''; $scriptaudiotime[$foil]=0; $scriptaudionull[$foil]=1; } $stem = ''; $stem = $localwwwdir . '/' if( $localwwwdir ); $source = $stem . 'audio.ra'; unless(-e $source) { mkdir($source,0755); } $ramsource = $source . 'm'; unless(-e $ramsource) { mkdir($ramsource,0755); } $source .= '/'; $ramsource .= '/'; # # Set Foil audio for($foil=1; $foil<=$totalfoils_ct; $foil++ ) { $rainfo = $source . 'foil' . $foil . '.rainfo'; unless( -e $rainfo ) { # Create from Constituents $ratest = $source . 'foil' . $foil . '.ra'; system("rm $ratest") if(-e $ratest); $ratest = $ramsource . 'foil' . $foil . '.ram'; system("rm $ratest") if(-e $ratest); $foilset = $listoffoilsets[$foil-1]; $localfoil = $listoffoils[$foil-1]; if( $foilaudioraurl[$foilset][$localfoil] ) { $rapos = $source . 'foil' . $foil . '.ra'; $com='cp ' . $foilaudioraurl[$foilset][$localfoil] . ' ' . $rapos; system($com); $scriptaudioraurl[$foil]= $rapos; } if( $foilaudioramurl[$foilset][$localfoil] ) { $rampos = $ramsource . 'foil' . $foil . '.ram'; $com='cp ' . $foilaudioramurl[$foilset][$localfoil] . ' ' . $rampos; system($com); $scriptaudioramurl[$foil]= $rampos; } $scriptaudiotime[$foil] = $foilaudiotime[$foilset][$localfoil]; $scriptaudionull[$foil] = $foilaudionull[$foilset][$localfoil]; } else { # Take what ever is set already open(RAINFO,'<'.$rainfo) || die("Sorry Could not open ",$rainfo," \n"); while( $grab= ) { $grab =~ m%([^:]*):(.*)$% ; $begingrab=$1; $endgrab=$2; $begingrab =~ tr/A-Z/a-z/; $scriptaudioraurl[$foil] = $stem . $endgrab if( $begingrab eq 'raplace' ); $scriptaudioramurl[$foil] = $stem . $endgrab if( $begingrab eq 'ramplace' ); $scriptaudiotime[$foil] = $endgrab if( $begingrab eq 'seconds' ); $scriptaudionull[$foil] = 0 if( ($begingrab eq 'nullaudio') && ( $endgrab eq 'no' ) ); } } } # # Set Abstract Audio $rainfo = $source . 'abstract.rainfo'; if( -e $rainfo ) { open(RAINFO,'<'.$rainfo) || die("Sorry Could not open ",$rainfo," \n"); while( $grab= ) { $grab =~ m%([^:]*):(.*)$% ; $begingrab=$1; $endgrab=$2; $begingrab =~ tr/A-Z/a-z/; $scriptabstractaudioraurl= $stem . $endgrab if( $begingrab eq 'raplace' ); $scriptabstractaudioramurl= $stem . $endgrab if( $begingrab eq 'ramplace' ); $scriptabstractaudiotime= $endgrab if( $begingrab eq 'seconds' ); $scriptabstractaudionull=0 if( ($begingrab eq 'nullaudio') && ( $endgrab eq 'no' ) ); } close(RAINFO); } # else { # Try to Create Abstract Audio from master abstract $ratest = $source . 'abstract.ra'; system("rm $ratest") if(-e $ratest); $ratest = $ramsource . 'abstract.ram'; system("rm $ratest") if(-e $ratest); if( $scriptpos eq 'masterabstract' ) { $oldstem = $foilsetparms[$masterset]{"wwwdir"} . '/'; $rainfo = $oldstem . '/audio.ra/abstract.rainfo'; if(-e $rainfo ) { open(RAINFO,'<'.$rainfo) || die("Sorry Could not open ",$rainfo," \n"); while( $grab= ) { $grab =~ m%([^:]*):(.*)$% ; $begingrab=$1; $endgrab=$2; $begingrab =~ tr/A-Z/a-z/; if( $begingrab eq 'raplace' ) { $rapos = $source . '/abstract.ra'; $com='cp ' . $oldstem . $endgrab . ' ' . $rapos; system($com); $scriptabstractaudioraurl= $rapos; } if( $begingrab eq 'ramplace' ) { $rampos = $source . '/abstract.ram'; $com='cp ' . $oldstem . $endgrab . ' ' . $rampos; system($com); $scriptabstractaudioramurl= $rampos; } $scriptabstractaudiotime= $endgrab if( $begingrab eq 'seconds' ); $scriptabstractaudionull=0 if( ($begingrab eq 'nullaudio') && ( $endgrab eq 'no' ) ); } close(RAINFO); } } else { # Try to Create Abstract Audio from Given Foil if( $scriptaudioraurl[$scriptpos] ) { $scriptabstractaudioraurl = $scriptaudioraurl[$scriptpos]; $scriptabstractaudioramurl = $scriptaudioramurl[$scriptpos]; $scriptabstractaudiotime = $scriptaudiotime[$scriptpos]; $scriptabstractaudionull = $scriptaudionull[$scriptpos]; } } } # } # End setupscriptaudio # # Return 0 if no audio and 1 if audio exists # Return Audio parameter in Display Parameter audioline for later use sub setupaudioline { # my($inputoption)=@_; my($i,$raurl,$ramurl,$audiotime,$audionull,$iconoffset,$audioline); # if( $inputoption eq 'audiototal' ) { if( $multi ) { for( $i=0; $i < $totalfoils_ct; $i++ ) { next if($scriptaudionull[$i]); return 1 if($scriptaudioraurl[$i]); } return 0; } else { # Individual Foilset for( $i=1; $i <= $totalfoils_ct; $i++ ) { next if($foilaudionull[$currentfoilset][$i]); return 1 if($foilaudioraurl[$currentfoilset][$i]); } return 0; } } if( $multi ) { # Script to be accessed if( ($looptype == 1) || ($looptype == 2) ) { # foilnumber in script $raurl = $scriptaudioraurl[$mixedfoilno]; $ramurl = $scriptaudioramurl[$mixedfoilno]; $audiotime = $scriptaudiotime[$mixedfoilno]; $audionull = $scriptaudionull[$mixedfoilno]; } else { # Abstract in Script $raurl = $scriptabstractaudioraurl; $ramurl = $scriptabstractaudioramurl; $audiotime = $scriptabstractaudiotime; $audionull = $scriptabstractaudionull; } } else { # Individual Foilset to be accessed if( ($looptype == 1) || ($looptype == 2) ) { # foilnumber in foilset $raurl = $foilaudioraurl[$currentfoilset][$currentfoilno]; $ramurl = $foilaudioramurl[$currentfoilset][$currentfoilno]; $audiotime = $foilaudiotime[$currentfoilset][$currentfoilno]; $audionull = $foilaudionull[$currentfoilset][$currentfoilno]; } else { # Abstract in Foilset $raurl = $abstractaudioraurl[$currentfoilset]; $ramurl = $abstractaudioramurl[$currentfoilset]; $audiotime = $abstractaudiotime[$currentfoilset]; $audionull = $abstractaudionull[$currentfoilset]; } } if( ($audionull != 0) || ($raurl eq '') ) { if( $inputoption eq 'audiochar' ) { $iconoffset = &jumpfoil($locpath,$filepath{'basedirectory'}); $valuewww{'audioline'} = ''; return 1; } $valuewww{'audioline'}=''; return 0; } $raurl = &jumpfoil($locpath,$raurl) if( $raurl ); $ramurl = &jumpfoil($locpath,$ramurl) if( $ramurl ); if( $inputoption eq 'audiobuttons' ) { $iconoffset = &jumpfoil($locpath,$filepath{'basedirectory'}); $audioline=''; if( $raurl ) { my($iconv) = &localitem('audiodownloadbutton'); $audioline = '' . $iconv . ''; } $audioline .= 'Secs '.$audiotime. ''; if( $ramurl ) { my($iconv) = &localitem('audioserverbutton'); $audioline .= '' . $iconv . ''; } } elsif( $inputoption eq 'audiochar' ) { $iconoffset = &jumpfoil($locpath,$filepath{'basedirectory'}); if( $ramurl ) { $audioline = ''; } elsif( $raurl ) { $audioline = ''; } else { $audioline = ''; } } else { $audioline = $audiotime . ',' . $raurl . ',' . $ramurl; } $valuewww{'audioline'}=$audioline; return 1; # } # End setupaudioline # # Read in Templates defined in WWWTEMPLATE and write files # according to templates on directory $wwwdir sub readwwwtemplate { # my($wwwtemplate)=$_[0]; my($mode,$i); # $newlinetobr=1; open(WWWTEMPLATE,"<".$wwwtemplate) || die("\nSorry couldnt Open ",$wwwtemplate, "\n"); $currentfoilset=$masterfoilset; $wwwdir=$_[1]; $wwwdirwritten=$_[2]; $wwwdirwritten="." unless $wwwdirwritten; $modewww=0; $mode=0755; mkdir $wwwdirwritten,$mode unless( defined(-e $wwwdirwritten)); chdir $wwwdirwritten; $basedirectory=$currentdirectory.'/'; $basedirectory = '' if($userelativefilenames == 1); $basedirectory .= $wwwdirwritten.'/' unless( $wwwdirwritten eq '.'); # undef %valuewww; undef %wwwalias_url; undef %wwwalias_title; undef %wwwalias_titlegiven; undef %wwwalias_comment; undef %wwwalias_author; undef %wwwalias_date; undef %wwwalias_url_used; &optwww; # $abstract=1; $globalfoilsettype = -1; $currentfoilset = $masterfoilset; if($multi == 0 && ($keepabsmissingoption[$currentfoilset]!=4) ) { &setimagesize(4); } elsif( $multi ==1 ) { &setimagesize(4) if($scriptabsrawimage); } $abstract=0; for($mixedfoilno=0; $mixedfoilno<$totalfoils_ct; $mixedfoilno++) { $currentfoilset=$listoffoilsets[$mixedfoilno]; $currentfoilno=$listoffoils[$mixedfoilno]; next if( $keepmissingoption[$currentfoilset][$currentfoilno] == 4); &setimagesize(4); } # for($i=0; $i<$totalscript_ct; $i++) { $wwwscriptdone[$i]=0; } $wwwabstractdone=0; for($i=0; $i<$totalfoils_ct; $i++ ) { $wwwfoilsdone[$i]=0; } &alias_cleanup; seek WWWTEMPLATE,0,0; $modewww=1; &optwww; chdir $currentdirectory; $newlinetobr=0; } # End routine controlling processing of WWWTEMPLATE # sub readalias { # Standalone Read alias file # my($file)=@_; # my($fullline); # undef %wwwalias_url; undef %wwwalias_title; undef %wwwalias_titlegiven; undef %wwwalias_comment; undef %wwwalias_author; undef %wwwalias_date; undef %wwwalias_url_used; # open(ALIAS,$file) || die("Sorry Couldnt read ALIAS ",$fullline," \n"); while($fullline=) { chomp($fullline); &alias_decode('',$fullline); } close(ALIAS); &alias_cleanup; } # sub alias_decode { # Decode alias definition # key is EITHER in first argument or in first entry in value1@value2@ .. # string transmitted as second argument # if key is alias assume next entry in string is real key! # my($key,$line)=@_; my(@fields,$test); # @fields=split(/@/,$line); $test=$fields[0]; $test =~ tr/A-Z/a-z/; shift(@fields) if($test eq 'alias'); $key=shift(@fields) unless $key; $key=shift(@fields) if $key eq 'alias'; # $wwwalias_url{$key}=$fields[0]; if($fields[1]) { $wwwalias_title{$key}=&tohtml($fields[1]); $wwwalias_titlegiven{$key}=1; } else { $wwwalias_title{$key}='At location ' . &tohtml($fields[0]); $wwwalias_titlegiven{$key}=0; } $wwwalias_comment{$key}= &tohtml($fields[2]); $wwwalias_author{$key}= &tohtml($fields[3]); $wwwalias_date{$key}= &tohtml($fields[4]); # } # End alias_decode # sub alias_cleanup { # my($name,$replace); # $setwwwref= -100001; $wwwurlref=0; foreach $name (keys %wwwalias_url) { $wwwalias_url_used{$name}=0; } foreach $name (keys %wwwalias_url) { $changed_alias=1; $replace=$wwwalias_url{$name}; while( $changed_alias) { $changed_alias=0; $replace=&alias_subst($replace); } $wwwalias_url{$name}=$replace; } foreach $name (keys %wwwalias_url) { $wwwalias_url_used{$name}=0; } } # End alias_cleanup # sub alias_subst { # my($total); # $end_alias=$_[0]; $total=""; while($end_alias) { if(&aliascurlyscan($end_alias)) { $total .= $begin_alias; my($tag_alias_clean) =$tag_alias; $tag_alias_clean =~ s/\s*//g; if( $full=$wwwalias_url{$tag_alias_clean} ) { if( &aliasroundbracket($end_alias) ) { $string_alias=$wwwalias_title{$tag_alias_clean} unless $string_alias; $total .= '' . $string_alias . ''; } else { $total .= $full; } ++$changed_alias; if( $setwwwref != -100001 ) { ++$wwwalias_url_used{$tag_alias_clean}; $foilreferenced[$wwwurlref]=$setwwwref; $tagreferenced[$wwwurlref]=$tag_alias_clean; ++$wwwurlref; } } else { $total .= '{' . $tag_alias . '}'; } next; } else { $total .= $begin_alias; last; } } # End loop over curly brackets return $total; # } # End alias_subst # sub aliasroundbracket { # $end_alias=$_[0]; if( $end_alias =~ m%^\\\(% ) { $end_alias =~ s/^.//; return 0; } if( $end_alias =~ m%^\(([^\(\)]*)\)(.*)% ) { $string_alias= $1; $end_alias=$2; return 1; } return 0; # } # End aliasroundbracket # sub aliascurlyscan { # my($inline)=@_; my($line); # $line=$inline; $begin_alias=''; while($line) { # if( $line =~ m%([^{]*){([^}]*)}(.*)% ) { if( $1 =~ m%\\$% ) { $begin_alias .= $1 . '{'; $line = $2.'}'.$3; next; } $begin_alias .= $1; $end_alias=$3; $tag_alias=$2; return 1; } $begin_alias=$inline; $end_alias=''; $tag_alias=''; return 0; } # End loop over starting { $begin_alias=$inline; return 0; # } # End alias curly scan # sub optwww { # my($perswwwkey,$restwww,$linewww,$readwwwline,$colonwww,$entrywww,$optmemwww,$possiblewwwkey,$actualwwwkey,$index,$lefttest,$test,$bladd,$len,$parms); # %optwww= ("mkfile",11,"mkdir",12,"cd..",13,"contd",10,"type",15,"template",16, "comment",17,"nickname",14,"absrawimage",0,"foilrawimage",0,"searchline",0, "foreign",0,"native",0,"bestfoilurl",0,"bestfoilseturl",0,"bestabsurl",0,"imagesize",0,"imagetype",0, "beginalias",101,"endalias",102,"aliasfile",101, "wisdomoption",0,"wisdomtabletag",0,"wisdomtabletdtag",0, "abstract/title",0,"abstract/protectedtitle",0,"abstract/bullet1",0, "abstract/bullet2",0,"abstract/bullet3",0,"abstract/htmlline",0, "script/title",0,"script/protectedtitle",0,"script/bullet1",0, "script/bullet2",0,"script/bullet3",0,"script/htmlline",0, "foil/title",0,"foil/protectedtitle",0,"foil/bullet1",0, "foil/bullet2",0,"foil/bullet3",0,"foil/htmlline",0,"missing",0, "nextlocal",0,"prevlocal",0, "focusmissing",0,"htmlbutton",0,"focushtmlbutton",0,"setupcountbullets",0, "indexhtmlbutton",0,"indexfocushtmlbutton",0, "imagebutton",0,"focusimagebutton",0,"setupfocushtml",0,"setupfocusimage",0,"makefocusimage",0, "indeximagebutton",0,"indexfocusimagebutton",0, "next",0,"prev",0,"next2",0,"prev2",0,"localfoil#",0,"extfoil#",0); # $perswwwkey="NONE"; $path=""; $lastpath="NONE"; $lastlabel=''; $lasttemplate=''; $lasttype=''; $wwwalias_mode=0; # for $optmemwww (keys %optwww) { $valuewww{$optmemwww}="NONE"; } # # Set Padded Label and other processed Foilset Options for($index=0;$index<$totalfoilset_ct;$index++) { $keepoptions[$index]{"protectedtitleset"}= &protectquote($keepoptions[$index]{"titleset"}); $keepoptions_html[$index]{"protectedtitleset"} =0; $test=$keepoptions[$index]{"label"}; $lefttest=$keepoptions[$index]{"label"}; $len=length($test); for($bladd=$len;$bladd<$labellength;$bladd++) { $test .= ' '; $lefttest = ' ' . $lefttest; } $keepoptions[$index]{"padlabel"}=$test; $keepoptions_html[$index]{"padlabel"}=0; $keepoptions[$index]{"leftpadlabel"}=$lefttest; $keepoptions_html[$index]{"leftpadlabel"}=0; } # # Set up class 1 items with their allowed / prefixes for $optmemwww (@calcoptions,@readinoptions,@modifiedoptions) { $optwww{$optmemwww} =0; $valuewww{$optmemwww} = '{}'; $classwww{$optmemwww}=1; $classwww{'mixed/'.$optmemwww}=1; $classwww{'local/'.$optmemwww}=1; for($index=0;$index<$totalfoilset_ct;$index++) { $classwww{$foilsetparms[$index]{"name"}.'/'.$optmemwww}=1; } } # $classwww{"readabstract"}=2; $classwww{"readfoil"}=3; $classwww{"missing"}=4; $classwww{"title"}=5; $classwww{"bullets"}=6; $classwww{"aliaslist"}=7; $classwww{"fullaliaslist"}=9; $classwww{"urlsonly"}=8; $classwww{"next"}=10; $classwww{"next2"}=10; $classwww{"besturl"}=11; $classwww{"prev"}=12; $classwww{"prev2"}=12; $classwww{"localfoil#"}=13; $classwww{"extfoil#"}=14; $classwww{"nextlocal"}=15; $classwww{"prevlocal"}=16; $classwww{"select"}=17; $classwww{"nobulletsifgif"}=18; $classwww{"nonewlines"}=19; $classwww{"loopfoils"}=21; $classwww{"loopscript"}=23; $classwww{"loopfoilset"}=24; $classwww{"endloop"}=22; $classwww{"today"}=31; $classwww{"prettyprint"}=32; $classwww{"usedfoilslist"}=33; $classwww{"sortedfoilslist"}=34; $classwww{"local"}=35; $classwww{"mixed"}=36; $classwww{"global"}=36; $classwww{"linesize"}=37; $classwww{"foreign"}=38; $classwww{"native"}=39; $classwww{"bestfoilurl"}=40; $classwww{"bestabsurl"}=41; $classwww{"foilrawimage"}=43; $classwww{"absrawimage"}=44; $classwww{"searchline"}=45; $classwww{"lastdirectory"}=46; $classwww{"wwwdir"}=47; $classwww{"targetreplace"}=48; $classwww{"titlesize"}=49; $classwww{"bullet1size"}=52; $classwww{"bullet2size"}=53; $classwww{"urlsonlysize"}=54; $classwww{"viewname"}=55; $classwww{"protectedtitle"}=56; $classwww{"imagesize"}=57; $classwww{"imagetype"}=58; # horizr or vert $classwww{"basicaliassearch"}=59; $classwww{"fullaliassearch"}=60; $classwww{"setitem"}=61; $classwww{"focusmissing"}=62; $classwww{"htmlbutton"}=63; $classwww{"indexhtmlbutton"}=63; $classwww{"focushtmlbutton"}=63; $classwww{"indexfocushtmlbutton"}=63; $classwww{"focusimagebutton"}=64; $classwww{"indexfocusimagebutton"}=64; $classwww{"imagebutton"}=64; $classwww{"indeximagebutton"}=64; $classwww{"setupfocushtml"}=65; $classwww{"setupfocusimage"}=66; $classwww{"makefocusimage"}=67; $classwww{"setupcountbullets"}=68; $classwww{"imagewidth"}=69; $classwww{"imagehgt"}=70; $classwww{"imageheight"}=70; $classwww{"alignreplace"}=71; $classwww{"maxfoilnumber"}=72; $classwww{"addonsummary"}=73; $classwww{"addonlines"}=74; $classwww{"addonextra"}=75; $classwww{"criticalmissing"}=76; $classwww{"somemissing"}=77; $classwww{"imagestatus"}=78; $classwww{"abstractsource"}=79; $classwww{"abstracttitle"}=80; $classwww{"abstracthtml"}=81; $classwww{"bodyindex"} =82; $classwww{"bodysephtml"} =83; $classwww{"bodyimage"} =84; $classwww{"imagelocation"} =85; $classwww{"abstractimagelocation"} =86; $classwww{"cleanedupname"} =87; $classwww{"maximagewidth"} =88; $classwww{"maximageheight"} =89; $classwww{"nextfoilrawimage1"} =91; $classwww{"nextfoilrawimage2"} =92; $classwww{"nextfoilrawimage3"} =93; $classwww{"nextfoilrawimage4"} =94; $classwww{"nextfoilrawimage5"} =95; $classwww{"nextfoilmixedimage1"} =101; $classwww{"nextfoilmixedimage2"} =102; $classwww{"nextfoilmixedimage3"} =103; $classwww{"nextfoilmixedimage4"} =104; $classwww{"nextfoilmixedimage5"} =105; $classwww{"wwbodyindex"} = 106; $classwww{"wwbodysephtml"} = 107; $classwww{"wwbodyimage"} = 108; $classwww{"indexlayer"} = 109; # $valuewww{'wisdomoption'} = 'off'; for $parms (keys %displayparms) { $classwww{$parms}=51; $optwww{$parms}=51; $valuewww{$parms}=$displayparms{$parms}; } $classwww{"selectbrowser"}=50; # while( $linewww=) { chomp($linewww); if($wwwalias_mode==1) { $colonwww = index($linewww,"@"); $colonwww = index($linewww,":") unless $colonwww; } else { $colonwww = index($linewww,":"); } if ( ($linewww =~ /^\S/) && $colonwww < 0 ) { die("\nIllegal Continuation Line", $restwww,"\n") if $perswwwkey eq "NONE"; $linewww =~ s/^\s+/ /; $readwwwline = &join($readwwwline,$linewww); next; } $possiblewwwkey = substr($linewww ,0, $colonwww); $possiblewwwkey =~ s/\s+//g; $actualwwwkey=$possiblewwwkey; $possiblewwwkey =~ tr/A-Z/a-z/; $entrywww = -1; foreach $optmemwww (keys %optwww) { if( $possiblewwwkey eq $optmemwww ) { $entrywww = 1; last; } } if( ($perswwwkey ne 'beginalias') && ($wwwalias_mode == 0) && ($entrywww < 0) ) { die("\nIllegal key WWWTemplate ", $possiblewwwkey, "\n"); } $restwww = substr($linewww, $colonwww+1); $restwww =~ s/(\s)*//; if( $possiblewwwkey eq "contd" ) { die("\nIllegal Continuation Line", $restwww,"\n") if ($perswwwkey eq 'NONE'); $readwwwline = &join($readwwwline,$linewww); next; } else { &procwww($readwwwline,$perswwwkey) unless $perswwwkey eq 'NONE'; } $readwwwline = $restwww; $perswwwkey =$possiblewwwkey; $perswwwkey_nolc=$actualwwwkey; } &procwww($readwwwline,$perswwwkey); return if( $modewww == 0 ); &printwww($lastlabel) if( $lastlabel ); # } # End routine reading instructions controlling construction of WWW foil set # sub procwww { my($fullline,$key)=@_; my($testprocwww,$mode,$newlink,$oldlink,$i,$index,$typewww); # %typewww= ("overall",1,"fullhtml",2,"sephtml",3,"sepimage",4,"seporgimagedir",5,"other",6,"directory",7,"sepabshtml",8,"sepabsimage",9,"mixedhtml",10,"sepmixed",11,"sepgif",4,"seporggifdir",5,"sepabsgif",9); # # Process Aliases if($wwwalias_mode && ($key ne 'endalias') ) { return if $modewww; &alias_decode($perswwwkey_nolc,$fullline); return; } $testprocwww=$optwww{$key}; if( $testprocwww == 101 ) { unless($fullline) { $wwwalias_mode=1; return; } return if $modewww; open(ALIAS,$fullline) || die("Sorry Couldnt read ALIAS ",$fullline," \n"); while($fullline=) { chomp($fullline); &alias_decode('',$fullline); } close(ALIAS); $wwwalias_mode=0; return; } if( $testprocwww == 102 ) { $wwwalias_mode=0; return; } # $valuewww{$key}=$fullline; return if( $testprocwww <= 10 ); return if( $testprocwww == 17 ); return if( $testprocwww == 51 ); # if( $testprocwww >= 11 && $testprocwww <= 13 ) { # set up next file &printwww($lastlabel) if( $lastlabel && ($modewww==1) ); $lastlabel=''; $lasttype=''; $lasttemplate=''; } # if( $testprocwww == 11 ) { # New file defined if( $fullline =~ m%^/% ) { $lastpath=$fullline; } else { if($path) { $lastpath=$path.'/'.$fullline; } else { $lastpath=$fullline; }; } return; } # if( $testprocwww == 12 ) { # Directory set if( $fullline eq '$HOME' || $fullline eq '' ) { $path=""; $lastpath='/'; return; } $fullline =~ s%/$%% ; # Remove trailing / if( $fullline =~ m%^/% ) { # Absolute address $path=$fullline; $lastpath=$path.'/'; return; } else { # Relative address if( $path) { $path .= '/'.$fullline; } else { $path=$fullline; $lastpath= $path.'/'; } } return if $modewww==1; $createfile = $path; return if( defined(-e $createfile) ); $mode=0755; mkdir $createfile,$mode; return; } # if( $testprocwww == 13 ) { # cd.. if( $path ) { # Path exists already $path='' unless $path =~ s%/[^/]+$%% ; } else { $path = ".." } $lastpath=$path.'/'; return; } # if( $testprocwww == 15 ) { # type defined $fullline =~ tr/A-Z/a-z/; die "Illegal Type ",$fullline,"\n" unless $typewww{$fullline}; $lasttype=$typewww{$fullline}; return if $modewww==1; if( $lastlabel ) { die "Duplicate Type",$lasttype,"\n" if( $filetype{"lastlabel"} ); $filetype{"lastlabel"}=$lasttype; } return; } # if( $testprocwww == 16 ) { # template defined $lasttemplate=$fullline; return if $modewww==1; if( $lastlabel ) { die "Duplicate Type",$lasttemplate,"\n" if( $filetemplate{"lastlabel"} ); $filetemplate{"lastlabel"}=$lasttemplate; } return; } # if( $testprocwww == 14 ) { # Label defined die "No file defined for label ",$fullline,"\n" if( $lastpath eq "NONE" ); $lastlabel=$fullline; # $filepath{$lastlabel}=$lastpath; $filetype{$lastlabel}=$lasttype if( $lasttype ); $filetemplate{$lastlabel}=$lasttemplate if( $lasttemplate ); return if $modewww==1; # $classwww{$lastlabel}=11; $classwww{'mixed/'.$lastlabel}=11; $classwww{'local/'.$lastlabel}=11; for($index=0;$index<$totalfoilset_ct;$index++) { $classwww{$foilsetparms[$index]{"name"}.'/'.$lastlabel}=11; } # # Set up abstract IMAGE symbolic links correctly for single foilsets return if( $lasttype != 5) ; setrawimage($currentfoilset) if($multi == 0); return; } # } # End routine processing lines of information # sub setrawimage { # my($thisfoilset) =@_; my($abstest,$imagestem,$absnum,$oldlink,$newlink,$i); # $abstest= $originalabsrawimage[$thisfoilset]; $abstest =~ s%\s*$%%; $originalabsrawimage[$thisfoilset] = $abstest; unless($abstest) { $keepabsmissingoption[$thisfoilset]=4; $absrawimage[$thisfoilset] = ''; } else { $abstest =~ s/(\d*)$//; $absnum=$1; if( $abstest eq 'foil' ) { $absnum = &externalnumericlabel($absnum); $oldlink = $basedirectory . $path.'/'.$absnum; $imagestem = getimagetype($oldlink); unless($userelativefilenames) { $oldlink .= $imagestem; } else { # Relative filenames $oldlink = $absnum . $imagestem; } } else { $imagestem = $originalabsrawimage[$thisfoilset]; $imagestem =~ m%\.(\D*)$%; $imagestem = '.' . $1; $oldlink=&absolutefile($originalabsrawimage[$thisfoilset]); $oldlink = &jumpfoil($newlink,$oldlink) if($userelativefilenames); } $newlink= $basedirectory . $path . '/abstract'; $newlink .= $imagestem; unless( defined(-e $newlink) || (-l $newlink) ) { # Should try to create abstract link symlink $oldlink,$newlink; } unless( defined(-e $newlink) || (-l $newlink) ) { $keepabsmissingoption[$thisfoilset]=4; $absrawimage[$thisfoilset] = ''; } else { $absrawimage[$thisfoilset] = $path . '/abstract'. $imagestem; } } # # Set IMAGE Symbolic Links for single foilsets foils whose IMAGE location set by getimagefrom # Set $foilrawimage for all single foilsets for($i=1;$i<=$totalfoilcount[$thisfoilset];$i++) { unless($originalfoilrawimage[$thisfoilset][$i] eq '') { $imagestem = $originalfoilrawimage[$thisfoilset][$i]; $imagestem =~ s%\s*$%%; $originalfoilrawimage[$thisfoilset][$i] = $imagestem; $imagestem =~ m%\.([^\.]*)$%; $imagestem = '.' . $1; $newlink= $basedirectory . $path.'/'.(&externalnumericlabel($i)).$imagestem; unless( defined(-e $newlink) || (-l $newlink) ) { $oldlink= &absolutefile($originalfoilrawimage[$thisfoilset][$i]); $oldlink = &jumpfoil($newlink,$oldlink) if($userelativefilenames); symlink $oldlink,$newlink; } $foilrawimage[$thisfoilset][$i] = $path.'/'.(&externalnumericlabel($i)).$imagestem; } elsif( $keepmissingoption[$thisfoilset][$i] == 4 ) { $foilrawimage[$thisfoilset][$i] = ''; } else { $imagestem = $path.'/'.(&externalnumericlabel($i)); $foilrawimage[$thisfoilset][$i] = $imagestem . (&getimagetype($imagestem)); } } # End loop over foils return; # } # End setrawimage # sub absolutefile { # Get correct absolute file address # my($file)=@_; # $file =~s%\s*%%g; if(($file =~ m%^\/%) || ($file =~ m%^http%) ) { return $file; } $file = $basedirectory . $file; # } # End absolutefile # sub getimagetype { # Get extension of given file # my($stem)=@_; my($full,$match); # # Note must use ($match) else every other glob wrong -- see PERLOP manual page ... $full = &absolutefile($stem); ($match) = <$full*>; if(defined($match)) { $match =~ m%^$full(.*)%; return $1; } print('Warning missing image file ',$stem," globbed\n"); return 'MISSINGimageFILE'; # } # End getimagetype # sub printwww { # Actually write out files from templates # Key Pointers # $globalfoilsettype if -1 use mixed labelling # if n(>=0) use n'th foilset # $currentfoilset Current foilset of current foil # $currentfoilno Number of current foil within ITS OWN foilset # $mixedfoilno Number within mixed foilset # $multi if 0 single foilset, 1 if multiple # $looptype 1 foils * 2 script * 3 foilset # my($protect,$relfile,$i,$j,$temp,$loop,$lasti,$writefile,$testwww,$lastdir,$shortname,@list,@sortedlist); $loclabel=$_[0]; # $loctype=$filetype{$loclabel}; return if( ($loctype >= 5)&&($loctype<=7) ); $locpath=$filepath{$loclabel}; $loctemplate=$filetemplate{$loclabel}; die "Illegal path",$locpath,"\n" unless($locpath); die "Illegal type",$loctype,"\n" unless($loctype); die "Illegal template",$loctemplate,"\n" unless($loctemplate); # $nobulletsifgif=0; $nonewlines=0; open(TEMPLATE,"<".$loctemplate) || die("Sorry couldn't create ",$loctemplate,"\n"); @template =