#!/bin/tcsh -f
# build a summary of the html files in each dir that have
# been upgraded to CSS.
set me=$0:t # the name of this program
# Abort if the required env variables aren't set
if (! ${?HTML_DIR}) then
echo ${me}: HTML_DIR environment variable not set\!
exit
endif
cd $HTML_DIR
set theResult = $HTML_DIR/tech/css-progress.html
set theTestTag = css/base.css # the string that IDs a file as done
set tmpScript = /tmp/${me}.exec # the script file for find's 'exec'
set tmpScriptOut = /tmp/${me}.out # output from the script
set tmpTotal = /tmp/${me}.total #where the tally is kept
set tmpTotalToDo = /tmp/${me}.todo #where the tally is kept
set tmpTotalDone = /tmp/${me}.done #where the tally is kept
echo "Preparing CSS Upgrade progress report for ${HTML_DIR}..."
echo "0" > $tmpTotal #reset the tally to zero
echo "0" > $tmpTotalToDo #reset the tally to zero
echo "0" > $tmpTotalDone #reset the tally to zero
###########################
#create the exec command file for 'find'
cat << END_INPUT > $tmpScript
#!/bin/tcsh -f
cd \$1
set p = \`pwd | sed -e "s/^.*Sites\/ati/ati/" \`
set n = \`ls *html | wc -l\` #count the html files
set nOld = \`cat $tmpTotal\`
expr \$nOld + \$n > $tmpTotal
set nCSS = \`grep -l $theTestTag *html | wc -l\` #count the CSS-enabled files
set nOld = \`cat $tmpTotalDone\`
expr \$nOld + \$nCSS > $tmpTotalDone
set nToDo = \`expr \$n - \$nCSS\` # how many remain
if (\$nToDo > 0) then
echo -n '
'
echo
END_INPUT
chmod +x $tmpScript #make it executable
###########################
set theDate=`date "+$DATE_FORMAT_ATI_REV_DATE"`
############################
# Write the header
cat << END_INPUT > $theResult
CSS-conversion Progress SummaryHelp | Home » Technical Notes
CSS-conversion Progress Summary
$theDate
In early 2005 I decided to upgrade all of Access to Insight's 1,500+ pages to take
advantage of Cascading Style Sheets (CSS), a technology that will eventually
make the website easier to navigate, give its pages a more consistent and pleasing "look,"
and make it more accessible to our visually impaired visitors. To bring the pages into conformity
with CSS requires that the HTML code in every page be edited by hand. It's a time-consuming
process, but well worth the effort. This page shows how things are going.
END_INPUT
############################
# Now search through the driectories (excluding some), executing the script in each one
find . \( -path \*/cgi -o -path \*/css -o -path \*/unsupported -o -path \*/icon -o -path \*/images -o -path \*/.FBCLockFolder \) -prune -o -type d -exec $tmpScript {} \; >> $tmpScriptOut
# Edit the output to add hyperlinks to the listed directories
ed << END_INPUT $tmpScriptOut
%s/