#!/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 beforeCommit(frm)
{
	var deviceid = document.getElementsByName(\"deviceid\")[0];
	deviceid.value = TrimAll(deviceid.value);
	if (deviceid.value == \"\" && !IsDigitIn(deviceid.value, 0, 255)) {
		alert(\"豸ʶ豸ʶΪ0~255Χ\");
		deviceid.select();
		return false;
	}
	return true;
}
</script>
";
if [ "${REQUEST_METHOD}" = "POST" ]; then
	errmsg=`${FLOWEYE} logger config deviceid=${CGI_deviceid}`
	if [ "$?" != "0" ]; then
		afm_dialog_msg "ִ:${errmsg}"
	else
		afm_dialog_msg "ɹ!"
		afm_load_page 0 "${myself}"
		exit 0
	fi
else
	for nameval in `${FLOWEYE} logger stat`
	do
		eval "${nameval}"
	done
	CGI_deviceid="${deviceid}"
fi

echo -n "
<body>
"; cgi_show_title "־-->豸" 
echo -n "
";
for nameval in `${FLOWEYE} logger stat`
do
	eval "${nameval}"
done

echo -n "
<br>
<form method=post onsubmit=\"return beforeCommit(this)\" action=\"${myself}\">
<table width=700 border=0 cellspacing=0 cellpadding=3 bgcolor=\"#ffffff\">
<tr id=row1>
	<td style=\"width:20\"></td>
        <td align=left style=\"width:80\">豸</td>
        <td align=left width=*><input type=text name=deviceid value=\"${CGI_deviceid}\" style=\"width:60\"></input>
		(0~255,豸űΨһʶ豸־ն˿ͨ˱־Դ)</td>
</tr>
</table>
<table style=\"width:700; border-bottom:1px #787882 solid; color:#0000ff\">
<tr><td align=right>&nbsp;</td></tr>
</table>
<table style=\"width:700\"> 
<tr>
        <td align=right>
		<input type=submit style=\"width:80\" value=\"ύ\"></input>
	</td>
</tr>
</table>
</form>
</body>
</html>
";