#!/bin/sh
echo 'Content-type: text/html

<title>DEMO Conference Digest</title>
<body bgcolor="linen">
<h1 align=center>DEMO Conference Digest</h1>
<center>
<p align=center>
<table border><tr>
<td><a href=conferences.cgi>By conference date (current)</a>&nbsp;
<td><a href=conferences.cgi?ALL>By conference date (all)</a>&nbsp;
<tr>
<td><a href=conferences.cgi?SUB>By submission deadline (current)</a>&nbsp;
<td><a href=conferences.cgi?SUBALL>By submission deadline (all)</a>&nbsp;
</table>
<p>
<a href=submit.html>Click here to add a conference to this list</a>
</center>
<P>
<center>
<table bgcolor="white" border>
<tr><td>Conference<br>Date
<td>Submission<br>Deadline
<td>Acronym
<td>Conference<br>Name
<td>Where
<td>Comments
<tr>
'
case x$QUERY_STRING in
    *ALL*) all=1;;
    *) all=0;;
esac
case x$QUERY_STRING in
    *SUB*) sub=1;;
    *) sub=0;;
esac
file=conferences.list
case $sub in
1) : 
     /usr/local/bin/perl subdate.pl 
     file=conferences.sub ;;
esac
case $all in
0)
    # to eliminate past conferences...
    # we get todays' date
    today=`date +%Y%m%d`
    # then count how many of them are not expired
    count=`sort $file | cut -c1-8 | awk '
	{if ($1 >= today) count++} END {print count}'  today=$today count=0 `
    #echo count=$count
    # then we get the tail of the sorted list
    sort $file | cut -c9- | tail -$count ;;
1)
    sort $file | cut -c9- ;;
esac
echo '
</table>
</center>
<p>
<a href=submit.html>Click here to add a conference to this list</a>
<p>
'
echo '
<hr>
<a href=..>Back to DEMO private pages</a>'
