# This script creates a html fax page for external-free use. Another
# script creates two html fax pages, one for internal use and one for
# external-fee use.
# The internal and external-fee pages contain links to the same faxes.
# The external-free page does not have some of the faxes that are reserved
# for fee use.
# Author: Cynthia Roush
# Creation Date: 08/94
# Change History:
# 9/19/94 CR Don't use US-specific faxes; remove my name and
# address from end of created page.
# 3/30/95 CR Changed header file
# 8/28/95 CR Pick up categories from group.names
# instead of hard-coding it in this script.
# 9/19/95 CR/ER Cut 4fax number from db and add it to all$
# Mike decided against.
. /u/hsim/other/fax.data/scripts/setvars
cd $TMPDIR
tmp=tmp$$
tmp1=tmp1$$
# path to be used in hrefs; need backslashes because will be used with sed
CNTRY=usa
PBIN="\/pbin-$CNTRY"
GETOBJ="$PBIN\/getobj.pl"
REFPATH="$GETOBJ\?\/pdocs-usa\/tips\/"
# remove comments, links, and limited distribution faxes
sed "/^#/d" $FAXDB > $tmp
sed "/ $tmp1
sed "/! limited/d" $tmp1 > $tmp
sed "/! US /d" $tmp > $tmp1
mv $tmp1 $tmp
# remove fee faxes
sed "/! fee !/d" $tmp > $tmp1
mv $tmp1 $tmp
# sort by date
sort -r -t ! -o $tmp1 -k $DT_FIELD $tmp
mv $tmp1 src.dt.$$
while read LINE
do
# Get variables from LINE, which was read from group.names
COMPGRP=`echo $LINE | sed "s/^\(...\).*/\1/"`
TITLE=`echo $LINE | sed "s/^... *\(.*\)$/\1/"`
# Write title to contents list
echo "$TITLE" >> contents$$
# Separate component groups
grep "! $COMPGRP !" src.dt.$$ > group$$
# Separate file name and doc title, revision date and 4FAX#
cut -c$FN_COLS group$$ > fn$$
cut -c$TTL_COLS group$$ > ttl$$
cut -c$DT_COLS group$$ > dt$$
# cut -c$NUM_COLS group$$ > num$$
# Remove blanks around file names
/u/hsim/execs/endblanks fn$$
sed "s/^ //" fn$$ > $tmp
mv $tmp fn$$
# copy file name column because need it twice
cp fn$$ fn2$$
# add html syntax
sed "s/^/ $tmp
sed "s/$/>/" $tmp > fn$$
sed "s/$/)<\/a>/" fn2$$ > $tmp
sed "s/^/(/" $tmp > fn2$$
mv ttl$$ $tmp
sed "s/$/<\/a>/" $tmp > ttl$$
# change format of date
sed "s/^ *\(..\)\(..\)\(..\)/\2\/\3\/\1/" dt$$ > $tmp
mv $tmp dt$$
# put parathesis around 4fax# in num$$
# sed "s/\([^ ][^ ][^ ][^ ]\)/(4FAX# \1)/" num$$ > $tmp
# mv $tmp num$$
# put file names and doc titles and dates together
paste -d " " fn$$ dt$$ ttl$$ > all$$
# add rest of link syntax
echo "" >> final.dt.$$
echo "" >> final.dt.$$
cat all$$ >> final.dt.$$
echo "
" >> final.dt.$$
done < $DBDIR/group.names
# Add header and footer information
/u/hsim/execs/endblanks final.dt.$$
#cat $EXECDIR/header.www.pub.html final.dt.$$ $EXECDIR/footer.www.html > $HTMLDIR/faxes.free.html
cat $EXECDIR/header.www.pub.html > $HTMLDIR/faxes.free.html
cat contents$$ >> $HTMLDIR/faxes.free.html
echo "" >> $HTMLDIR/faxes.free.html
echo "