#!/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`
if [ "${REQUEST_METHOD}" = "POST" ]; then
	errmsg=`${FLOWEYE} if set name=${CGI_ifname} zone=${CGI_ifzone} mode=${CGI_ifmode}`
	if [ "$?" != "0" ]; then
		afm_dialog_msg "ִ:${errmsg}"
	else
		afm_dialog_msg "ɹ!"
	fi
fi

echo -n "
<body>
<script type=\"text/javascript\" src=\"/img/wz_tooltip.js\"></script>
<span id=\"hlpup\" style=\"display:none\">˽ӿڴ״̬</span>
<span id=\"hlpdown\" style=\"display:none\">˽ӿûнӵ</span>
<span id=\"hlpdrv\" style=\"display:none\">ǿִ֧,øѡ:<br>(1) Intel 82541/2/3/5/6ϵ<br>(2) Intel 82571/82572/82573/82574/82583ϵ</span>
"; 
if [ "${MAIN_RTPORT}" = "" ]; then
	cgi_show_title "->ݽӿ" 
else
	cgi_show_title "->ؽӿ"
fi

echo -n "
<br>
<table width=800 border=0 cellspacing=1 cellpadding=1>
<tr id=tblhdr height=22>
	<td width=70 align=center>ӿ</td>
	<td width=100 align=center>Ӧģʽ</td>
	<td width=100 align=center>λ</td>
	<td width=100 align=center></td>
	<td width=100 align=center>״̬</td>
	<td width=120 align=center>ͺ</td>
	<td width=* align=center></td>
</tr>
";
idname="row1"
${FLOWEYE} if list | \
while read ifname ifmode ifzone ifstatus ifdriver ifmac ifdesc theothers 
do
    echo "<form method=post action=\"${myself}\"><tr id=${idname}>"
    if [ "${ifstatus}" = "up" ]; then
        echo "<td align=center style=\"color:#0000ff\"><a onmouseover=\"TagToTip('hlpup')\" onmouseout=\"UnTip()\">${ifname}</a>"
    else
        echo "<td align=center style=\"color:#ff0000\"><a onmouseover=\"TagToTip('hlpdown')\" onmouseout=\"UnTip()\">${ifname}</a>"
    fi
    echo "<td align=center>"
    echo     "<select name=ifmode style=\"width:100%\" value=${ifmode}>"
    for bdg in 0 1 2 3 4; do
        selected=""
        [ ${ifmode} -eq ${bdg} ] && selected="selected"
        if [ ${bdg} -eq 0 ]; then
            echo "<option value=${bdg} ${selected}>ģʽ</option>"
        else
            echo "<option value=${bdg} ${selected}>${bdg}</option>"
        fi
    done
    echo  "</select></td>"
    echo "<td align=center>"
    echo     "<select name=ifzone style=\"width:100%\" value=${ifzone}>"
    if [ "${ifzone}" = "inside" ]; then
        echo "<option value=inside selected></option>"
        echo "<option value=outside></option>"
    else
        echo "<option value=inside></option>"
        echo "<option value=outside selected></option>"
    fi
    echo     "</select>"
    echo "</td>"
    if [ "${ifdriver}" = "PANAOS" ]; then
    	echo "<td align=center><a style=\"color:#0000ff\">ǿ</a></td>"
    else
        echo "<td align=center><a style=\"color:#0000ff\" onmouseover=\"TagToTip('hlpdrv')\" onmouseout=\"UnTip()\">${ifdriver}</a></td>"
    fi
    if [ "${ifstatus}" = "up" ]; then
        echo "<td align=center style=\"color:#0000ff\"></td>"
    else
        echo "<td align=center style=\"color:#ff0000\">ûнӵ</td>"
    fi
    echo "<td align=center>${ifdesc}</td>"
    echo "<td align=center>"
    echo "<input type=hidden name=ifname value=${ifname}></input>"
    echo "<input type=hidden name=task value=ifdata></input>"
    echo "<input type=submit style="width:80" value="ύ"></input>"
    if [ "${ifdriver}" = "PANAOS" ]; then
	echo "&nbsp;&nbsp;<a style=\"color:#0000ff\" href=\"/cgi-bin/Setup/if_speed?ifname=${ifname}\"></a>"
    fi
    echo "</td></tr></form>"
    if [ "${idname}" = "row1" ]; then
        idname="row2"
    else
	idname="row1"
    fi
done
cd -

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