#!/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`"
fromgrpname=`${FLOWEYE} urlfilter listgrp | grep "^${CGI_fromgrp} " | cut -d' ' -f2`

echo -n "
<script type=\"text/javascript\" src=\"/img/common.js\"></script>
<script language=\"javascript\">
function beforeCloneGroup(frm)
{
	var grp = document.getElementsByName(\"grpname\")[0];
	grp.value = TrimAll(grp.value);
	if (grp.value == \"\") {
		alert(\"!\");
		grp.select();
		return false;
	}
	return true;
}
function onCancel()
{
	window.location.href = \"/cgi-bin/Setup/urlfilter_getgrp?policy=${CGI_fromgrp}\";
}
</script>
";
if [ "${REQUEST_METHOD}" = "POST" ]; then
	errmsg=`${FLOWEYE} urlfilter clonegrp from=${CGI_fromgrp} to=${CGI_grpname}`
	if [ "$?" != "0" ]; then
		afm_dialog_msg "ʧ:${errmsg}"
	else
		afm_dialog_msg "ɹ!"
		afm_load_page 0 "/cgi-bin/Setup/urlfilter_getgrp?policy=${CGI_grpname}"
		exit 0
	fi
fi

echo -n "
<body> 
"; cgi_show_title "ӿ->->Ʋ" 
echo -n "
<br>
<form method=post onsubmit=\"return beforeCloneGroup(this)\" action=\"${myself}\">
<table width=\"600\" border=0 cellspacing=0 cellpadding=3 bgcolor=\"#ffffff\">
<tr id=row1>
	<td width=40></td>
	<td width=120 align=left>Ʋ</td>
	<td width=150 align=left><b>${fromgrpname}</b></td>
	<td width=*></td>
</tr>
<tr id=row1>
	<td></td>
	<td align=left>²</td>
	<td align=left>
		<input type=text class=text name=grpname style=\"width:100%\" size=32></input>
	</td>
	<td width=*></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=fromgrp value=\"${CGI_fromgrp}\"></input>
                <input type=submit style=\"width:100\" value=\"Ʋ\"></input>
                &nbsp;&nbsp;&nbsp;<input type=button style=\"width:100\" value=\"ȡ\" onclick=\"onCancel()\"></input>
        </td>
</tr>
</table>
</form>
</body>
</html>
";