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

"
echo -n "";
if [ "${PALANG}" = "en" ]; then
	LANG_001="Config"
	LANG_002="Structure"
	LANG_003="Status"
	LANG_004="Error"
	LANG_005="Success"
	LANG_006="Add"
	LANG_007="Group ID"
	LANG_008="User Pool"
	LANG_009="Operation"
fi
CGI_browsertitle="Drcom"
. ../../common/common.sh 
myself="/cgi-bin/App/drcom/`basename $0`"
MOD_TAB_LIST="${LANG_001:=}#/cgi-bin/App/drcom/webmain ${LANG_002:=ܹ}#/cgi-bin/App/drcom/drcom_map ${LANG_003:=״̬}#/cgi-bin/App/drcom/drcom_stat"
APPCTRL=/usr/ramdisk/app/drcom/appctrl
. /etc/PG.conf
APPCTRL=/usr/ramdisk/app/drcom/appctrl
if [ "${REQUEST_METHOD}" = "POST" ]; then
	errmsg=`${FLOWEYE} drcom set pid=${CGI_pid} oid=${CGI_oid}`
	if [ "$?" != "0" ]; then
		afm_dialog_msg "${LANG_004:=ִ}: ${errmsg}"
	else
		afm_dialog_msg "${LANG_005:=ɹ}"
	fi
fi
if [ "${CGI_action}" = "remove" ]; then
	errmsg=`${FLOWEYE} drcom remove oid=${CGI_oid}`
	if [ "$?" != "0" ]; then
		afm_dialog_msg "${LANG_004:=ִ}: ${errmsg}"
	else
		afm_dialog_msg "${LANG_005:=ɹ}"
	fi
fi

echo -n "
<script language=\"javascript\">
function beforeCommit(frm)
{
	return true;
}
</script>
<body>
"; cgi_print_mod_header "${LANG_002:=ܹ}" "100%" 
echo -n "
<form method=post action=\"${myself}\">
<table width=600 border=0 cellspacing=0 cellpadding=3 bgcolor=\"#ffffff\" class=\"table-striped\">
<tr id=row1 class=\"tbot-border\" id=\"tblhdr\">
	<td align=center>${LANG_007:=ƷID}</td>
	<td align=center width=\"150px\">${LANG_008:=Panabitַ}</td>
	<td align=\"center\">${LANG_009:=}</td>
</tr>
<tr id=row1 id=\"tblhdr\">
	<td align=center>
		<input type=\"text\" value=\"\" name=\"oid\" style=\"width:180px\" />
	</td>
	<td align=center>
		<select name=\"pid\" style=\"width:180px\">
		";
			${FLOWEYE} pppoeippool list | while read id name other
			do
				echo "<option value=\"${id}\">${name}</option>"
			done
		
echo -n "
		</select>
	</td>
	<td align=center>
		<input type=\"hidden\" name=\"action\" value=\"add\" />
		<input type=\"submit\" class=\"btns\" value=\"${LANG_006:=}\" style=\"width:80px\" />
	</td>
</tr>
";
${FLOWEYE} drcom list | while read oid pid name other
do

echo -n "
	<tr id=\"row1\"><td align=\"center\">${oid}</td><td align=\"center\">${name}</td><td align=\"center\"><a href=\"${myself}?action=remove&oid=${oid}\"><img src=\"/img/delete.png\" /></a></td></tr>
";
done

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