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

echo -n "
<script type=\"text/javascript\" src=\"/img/common.js\"></script>
<script language=\"javascript\">
function beforeAddExt(frm)
{
	var extname = document.getElementsByName(\"extname\")[0];
	var extlist = document.getElementsByName(\"exts\")[0];
	extname.value = TrimAll(extname.value);
	if (!IsName(extname.value)) {
		alert(\"вܰ&ַ!\");
		extname.select();
		return false;
	}
	extlist.value = TrimAll(extlist.value);
	if (extlist.value == \"\") {
		alert(\"б!\");
		extlist.select();
		return false;
	}
	return true;
}
function onCancel()
{
	window.location.href = \"/cgi-bin/Protocol/urlextgrp_list\";
}
</script>
";
if [ "${REQUEST_METHOD}" = "POST" ]; then
	errmsg=`${FLOWEYE} urlfilter setext name=${CGI_extname} exts=${CGI_exts}`
	if [ "$?" != "0" ]; then
		afm_dialog_msg "ִ:${errmsg}"
	else
		afm_dialog_msg "ɹ!"
		afm_load_page 0 "/cgi-bin/Protocol/urlextgrp_list"
		exit 0
	fi
fi

echo -n "
<body>
"; 
cgi_show_title "Զ->ļ->"

echo -n "
<br>
<form method=post onsubmit=\"return beforeAddExt(this)\" action=\"${myself}\">
<table width=800 border=0 cellspacing=0 cellpadding=3 bgcolor=\"#ffffff\">
<tr id=row1>
	<td width=40></td>
        <td width=100 align=left>Ⱥ</td>
        <td width=* align=left><input type=text name=extname style=\"width:150px\"></input></td>
</tr>
<tr id=row1>
	<td width=40></td>
        <td width=100 align=left>б</td>
        <td width=* align=left><input type=text name=exts style=\"width:400px\"></input>&nbsp;(zip,rar,֮ԶŸ)</td>
</tr>
</table>
<table style=\"width:800; border-bottom:1px #787882 solid; color:#0000ff\">
<tr><td align=right>&nbsp;</td></tr>
</table>
<table style=\"width:800\"> 
<tr>
        <td align=right>
		<input type=submit style=\"width:80\" value=\"ύ\"></input>
		<input type=button style=\"width:80\" value=\"ȡ\" onclick=\"onCancel()\"></input>
	</td>
</tr>
</table>
</form>
</body>
</html>
";