#!/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/Setup/`basename $0`"

echo -n "
<script type=\"text/javascript\" src=\"/img/common.js\"></script>
<script language=\"javascript\">
function onCancel()
{
	window.location.href = \"/cgi-bin/Setup/if_data\";
}
</script>
";
if [ "${REQUEST_METHOD}" = "POST" ]; then
	errmsg=`${FLOWEYE} em setspeed ${CGI_ifname} ${CGI_ifspeed}`
	if [ "$?" != "0" ]; then
		afm_dialog_msg "ʧ:${errmsg}"
	else
		afm_dialog_msg "ɹ!"
		afm_load_page 0 "${myself}?ifname=${CGI_ifname}"
		exit 0
	fi
fi
ifspeed=`${FLOWEYE} em stat ${CGI_ifname} | grep "^media" | cut -d' ' -f3`

echo -n "
<body>
"; cgi_show_title "ݽӿ->" 
echo -n "
<br>
<form method=post action=\"${myself}\">
<table style=\"font:14px\" width=600 border=0 cellspacing=0 cellpadding=3 bgcolor=\"#ffffff\">
<tr id=row1>
	<td width=40></td>
        <td width=80 align=left>ӿ</td>
	<td width=400 align=left><b>${CGI_ifname}</b></td>
</tr>
<tr id=row1>
	<td></td>
        <td align=left>ǰ</td>
        <td align=left>
		<select name=ifspeed value=\"${ifspeed} style=\"width:100\"> ";
		case "${ifspeed}" in
		"AUTO")
			autoyes="selected"
			;;
		"100TX")
			tx100yes="selected"
			;;
		"1000T")
			t1000yes="selected"
			;;
		"1000SX")
			sx1000yes="selected"
			;;
		"1000LX")
			lx1000yes="selected"
			;;
		esac 
echo -n "
		<option value=\"auto\" ${autoyes}>Ӧ</option>
		<option value=\"100tx\" ${tx100yes}>100Mȫ˫</option>
		<option value=\"1000t\" ${t1000yes}>1000Mȫ˫</option>
		<option value=\"1000sx\", ${sx1000yes}>ģ1000Mȫ˫</option>
		<option value=\"1000lx\", ${lx1000yes}>ģ1000Mȫ˫</option>
		</select>
	</td>
</tr>
</table>
<table style=\"width:600; border-bottom:1px #787882 solid; color:#0000ff\">
<tr><td align=right>&nbsp;</td></tr>
</table>
<table style=\"width:600\"> 
<tr>
        <td align=right>
		<input type=hidden name=ifname value=\"${CGI_ifname}\"></input>
		<input type=submit style=\"width:80\" value=\"ύ\"></input>
		<input type=button style=\"width:80\" value=\"ȡ\" onclick=\"onCancel()\"></input>
	</td>
</tr>
</table>
</form>
</body>
</html>
";