#!/bin/sh
#This script is created by ssparser automatically. The parser first created by MaoShouyan
printf "Content-type: text/html
Cache-Control: no-cache

"
echo -n "";
. ../common/common.sh 
myself="/cgi-bin/Maintain/`basename $0`"

echo -n "
<script type=\"text/javascript\" src=\"/img/common.js\"></script>
<script language=\"javascript\">
function showLog(logfile)
{
	window.location.href = \"/cgi-bin/Maintain/web_log?logfile=\" + logfile;
}
function deleteLog(logfile)
{
	if (confirm(\"ȷҪɾ־ļ?\"))
		window.location.href = \"/cgi-bin/Maintain/history_log?action=delete&logfile=\" + logfile;
}
</script>
<body>
";
if [ "${CGI_action}" = "delete" ]; then
	rm -f ${DATAPATH}/${CGI_logfile}
fi
cgi_show_title "־->ʷ־" 

echo -n "
<br>
<table width=700 border=0 cellspacing=1 cellpadding=1>
<tr id=tblhdr height=22>
	<td width=250 align=center>ļ</td>
	<td width=120 align=center>¼</td>
	<td width=120 align=center>ļС</td>
	<td width=* align=center></td>
</tr>
";
todayfile="web_`date +%Y.%m.%d`.log"
tblid="row1"
cd ${DATAPATH}
filelist=`ls web_*.log 2>/dev/null`
if [ "$?" = "0" ]; then
	for logfile in ${filelist}
	do
		[ "${logfile}" = "${todayfile}" ] && continue

echo -n "
		<tr id=${tblid}>
		<td align=left>&nbsp;&nbsp;${logfile}</td>
		<td align=center>`cat ${DATAPATH}/${logfile} | wc -l`</td>
		<td align=center>`ls -l ${DATAPATH}/${logfile} | awk '{print $5}'`</td>
		<td align=center>
			<a style=\"color:#0000ff\" href=\"javascript:showLog('${logfile}')\">&nbsp;ʾ־&nbsp;</a>
                	<a style=\"color:#0000ff\" href=\"javascript:deleteLog('${logfile}')\">&nbsp;ɾ־&nbsp;</a>
		</td>
		</tr>
";
		if [ "${tblid}" = "row1" ]; then
			tblid="row2"
		else
			tblid="row1"
		fi
	done
fi

echo -n "
</table>
</body>
</html>
";