#!/bin/sh
# Generate hypertext/css menu from directory list
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"
here='NODELIST'
echo "<HTML><HEAD>"
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; ISO-8859-1\">"
echo "<style type=\"text/css\">"
echo "<TITLE>IFDC FileGate: $here</TITLE>"
#
echo ".gradient {"
echo "padding: 5px 5px 5px 5px;"
echo "background: #55aaee;"
echo "background: -moz-linear-gradient(top, #55aaee, #003366);"
echo "background: -webkit-gradient(linear, left top, left bottom, from(#55aaee), to(#003366));"
echo "height: auto;"
echo "repeat: repeat-x;"
echo "width: 150px;"
echo "height: 254px;"
echo "margin: 4px 0px 0px 4px;"
echo "border: 2px solid #cccccc;"
echo "}"
echo "br {"
echo "clear: left;"
echo "}"
echo "div.wrapper {"
echo "margin-bottom: 1em;"
echo "}"
#
echo "#tswcsstabs ul {"
 echo "border: 2px solid #cccccc;"
 echo "margin: 2px 0px 0px 379px;"
 echo "list-style-type: none;"
 echo "list-style-image: none;"
 echo "display: inline;"
 echo "font-size: small;"
 echo "list-style-position: outside;"
 echo "width: 120px;"
 echo "max-width: 120px;"
 echo "  color: yellow;"
 echo "font-family: Arial,Helvetica,sans-serif;"
 echo "font-weight: normal;"
 echo "padding: 5px;"
 echo "background: #55aaee;"
 echo "background: -moz-linear-gradient(top, #55aaee, #003366);"
 echo "background: -webkit-gradient(linear, left top, left bottom, from(#55aaee), to(#003366));"
 echo "height: auto;"
 echo "background-repeat: repeat-x;"
 echo "}"
 echo "#tswcsstabs ul li {"
 echo "background: #55aaee;"
 echo "background: -moz-linear-gradient(top, #55aaee, #003366);"
 echo "background: -webkit-gradient(linear, left top, left bottom, from(#55aaee), to(#003366));"
 echo "background-repeat: repeat-x;"
 echo "margin: 2px 0px 0px;"
 echo "padding: 2px 2px 1px 1px;"
 echo "text-align: center;"
 echo "list-style-type: none;"
 echo "list-style-position: outside;"
 echo "display: inline;"
 echo "list-style-image: none;"
 echo "font-size: small;"
 echo "width: 120px;"
 echo "max-width: 120px;"
 echo "color: yellow;"
 echo "opacity: 0.9;"
 echo "}"
 echo "#tswcsstabs li a {"
 echo "margin: 2px 0px 0px 10px;"
 echo "padding: 2px 2px 1px 1px;"
 echo "color: #ffff00;"
 echo "font-size: small;"
 echo "text-decoration: none;"
 echo "display: inline;"
 echo "width: 120px;"
 echo "max-width: 120px;"
 echo "}"
 echo "#tswcsstabs li a:hover {"
 echo "margin: 2px 0px 0px 10px;"
 echo "padding: 5px;"
 echo "background-color: #c8c8ff;"
 echo "color: #000000;"
 echo "font-size: small;"
 echo "width: 120px;"
 echo "max-width: 120px;"
 echo "}"
 #
echo "#mybutton {"
echo "color: 000099;"
echo "font-family: Arial,Helvetica,sans-serif;"
echo "margin: 0px 0px 0px 150px;"
echo "padding: 5px;"
echo "list-style-type: none;"
echo "list-style-image: none;"
echo "text-align: left;"
echo "color: #ffff00;"
echo "display: inline;"
#echo "width: auto;"
echo "font-size: small;"
echo "font-weight: inherit;"
echo "height: 250px;"
echo "position: absolute;"
echo "font-family: Arial,Helvetica,sans-serif;"
echo "}"
#
echo "#mybutton ul {"
echo "list-style-type: none;"
echo "list-style-image: none;"
echo "display: inline;"
echo "text-align: left;"
echo "font-size: small;"
echo "font-weight: inherit;"
echo "color: #000099;"
echo "font-family: Arial,Helvetica,sans-serif;"
#echo "width: auto;"
echo "}"
echo "#mybutton li {"
echo "height: auto;"
echo "list-style-type: none;"
echo "list-style-image: none;"
echo "display: inline;"
echo "font-size: small;"
echo "text-align: left;"
echo "font-weight: inherit;"
echo "color: #000099;"
echo "font-family: Arial,Helvetica,sans-serif;"
echo "float: left;"
#echo "width:auto;"
echo "}"
echo "#mybutton li a {"
echo "list-style-type: none;"
echo "list-style-image: none;"
echo "display: inline;"
echo "display: block;"
#echo "width: auto;"
echo "text-decoration: none;"
echo "font-size: small;"
echo "color: #000099;"
echo "font-weight: inherit;"
echo "}"
echo "#mybutton li a:hover {"
echo "background-color: #c8c8ff;"
echo "font-weight: bold;"
echo "color: #000000;"
echo "font-size: small;"
echo "}"
#
echo "body {"
echo "text-decoration: none;"
echo "color: #000066;"
echo "background-image: url(http://www.filegate.net/background.png);"
echo "position: static;"
echo "font-size: smaller;"
echo "background-repeat: repeat-x;"
echo "font-weight: bold;"
echo "float: left;"
echo "top: 0em;"
echo "margin-left: 5em;"
echo "z-index: 0;"
echo "margin-top: 0em;"
echo "}"

echo ".list {"
echo "max-height: 200px;"
echo "z-index: 0;"
echo "margin-left: 350px;"
echo "color: #000099;"
echo "font-size: small;"
echo "margin-top: 10em;"
echo "list-style-type: none;"
echo "padding-top: 5px;"
echo "}"
#
echo "div.header {"
echo "width: 100%;"
echo "text-transform: capitalize;"
echo "color: #000099;"
echo "text-align: left;"
echo "font-size: smaller;"
echo "font-weight: bold;"
echo "margin-top: 5px;"
echo "padding-top: 5px;"
echo "margin-left: 450px;"
echo "background-color: transparent;"
echo "valign: top;"
echo "position: absolute;"
echo "}"
#
echo "#footer {"
echo "width: 100%;"
echo "border-top-color: #000099;"
echo "text-transform: capitalize;"
echo "border-top-style: solid;"
echo "color: #000099;"
echo "text-align: left;"
echo "font-size: smaller;"
echo "font-weight: bold;"
echo "margin-top: 5px;"
echo "padding-top: 5px;"
echo "background-color: transparent;"
echo "position: absolute;"
echo "bottom: 0;"
echo "}"
#
echo "p {"
echo "color: #000099;"
echo "font-weight: bold;"
echo "font-style: italic;"
echo "font-size: large;"
echo "margin-left: 1px;"
echo "float: left;"
echo "padding-left: 1px;"
echo "}"
echo ".box {"
echo "border: 1px solid #cccccc;"
echo "margin-right: 1px;"
echo "margin-left: 1px;"
echo "padding-right: 2px;"
echo "padding-left: 4px;"
echo "font-family: Arial,Helvetica,sans-serif;"
echo "font-size: medium;"
echo "width: 600px;"
echo "z-index: 0;"
echo "}"
echo ".vlist {"
echo "width: 95px;"
echo "position: absolute;"
echo "}"
#
echo "</style>"
echo "<meta content=\"Janis Kracht\" name=\"author\">"
echo "<meta content=$here>"
echo "</head><body>"
echo "<div id=\"tswcsstabs\">"
echo "<ul style=\"margin-left: 0;\">"
echo "<li><a href=\"http://www.filegate.net/\">Home</a></li>"
echo "<li><a href=\"http://www.filegate.net/zone1/index.html\">Join</a></li>"
echo "<li><a href=\"http://www.filegate.net/search.htm\">Search</a></li>"
echo "<li><a href=\"http://www.filegate.net/tickinfo.txt\">NewFiles</a></li>"
echo "<li><a href=\"mailto:janis@filegate.net\">Contact</a></li>"
echo "<li><a href=\"http://www.filegate.net/zone6/index.html\">Zone6</a></li>"
echo "<li><a href=\"http://www.filegate.net/desc.htm\">AreaDesc</a></li>"
echo "<li><a href=\"http://www.filegate.net/fidogaz/fidogaz.htm\">Read_FidoGazette</a></li>"
echo "<li><a href=\"http://www.filegate.net/chatmain.html\">Chat</a></li>"
echo "<li><a href=\"http://www.filegate.net/aguest/index.php\">GuestBook</a></li>"
echo "<li><a href=\"http://www.filegate.net/pdnlady.htm\">PDNLady</a></li>"
echo "</ul>"
echo "</div>"

echo "<h3><a href=\"http://www.filegate.net/\">/FileGate</a>NODELIST</h3>"
ls  *.z* -1B -td > ziplist
echo "<hr>"
echo "<br>"
echo "<div style=\"top: 51px; left: -224px;\" class=\"header\">"
echo "<h3><left-margin=\"650px\">File name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Date&nbsp;&nbsp;kB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dlds Description</left-margin=\"650px\"></h3>"
echo "</div>"
echo "<br>"
echo "<div class=\"wrapper\">"
echo "<div style=\"top: 104px; left: 70px;\" id=\"mybutton\">"
echo "<div class=\"box\">"
                      
#
for file in `cat ziplist`
do
  if
     test=`grep $file descript.ion`
then
exp2=`grep -w $file /home/bbs/files.txt`
#build=`expr "$file" : '\("$exp2"\)'`
 
#build=expr "$file" : '\($exp2\)'
#expr "$string" : '\($substring\)'
#	Extract $substring* at beginning of $string
#     build=`grep -w -F $file /home/bbs/files.txt| sed 's/                                /\n              /g'`
#
echo "<li><a href=\"http://www.filegate.net/nodelist/$file\">$file</a></li>"
build=`expr substr "$exp2" 14 length "$exp2"`

 echo "<li style=\"padding: 0pt 0pt 0pt 4em; width: 450px;\">$build</li>"
 echo "<br>"
 echo "<br>"
 

 fi
done

echo "<br>"
echo "</div>"
echo "</div>"
echo "</div>"
echo "<div style=\"top: 650px; left: 85px;\" id=\"footer\">"
echo "The IFDC FileGate is a Collaboration of Independent File Distribution Coordinators Copyright 1994-2013 by <a href=\"mailto:janis@filegate.net\">Janis Kracht</a><br>"
echo "<br>"
echo "</div>"

echo "</body></html>"

