#!/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`"
if [ "${CGI_urlextgrp}" = "" ]; then
	for grp in `${FLOWEYE} urlextgrp list | awk '{print $1}'`
	do
		CGI_urlextgrp="${grp}"
		break
	done
fi

echo -n "
<script type=\"text/javascript\" src=\"/img/common.js\"></script>
<script languate=javascript>
function deleteExt(grpid)
{
	if (confirm(\"ɾȺ飬ôͬصвԶᱻɾȷҪɾ?\")) 
		window.location.href = \"${myself}?action=delete\" + \"&urlextgrp=\" + grpid;
}
function modifyExt(grpid)
{
	window.location.href = \"/cgi-bin/Protocol/urlextgrp_edit?urlextgrp=\" + grpid;
}
function addExt()
{
	window.location.href = \"/cgi-bin/Protocol/urlextgrp_add\";
}
</script>
";
if [ "${CGI_action}" = "delete" ]; then
	errmsg=`${FLOWEYE} urlfilter setext id=${CGI_urlextgrp} name=none`
	if [ "$?" != "0" ]; then
		afm_dialog_msg "ִ:${errmsg}"
	else
		afm_dialog_msg "ɹ!"
		afm_load_page 0 "${myself}"
		exit 0
	fi
fi

echo -n "
<body>
"; cgi_show_title "Զ->ļ" 
echo -n "
<br>
<table width=900 border=0 cellspacing=1 cellpadding=1>
<tr id=tblhdr height=22>
        <td width=60  align=center></td>
        <td width=150 align=center></td>
	<td width=450 align=center>ļ͸Ҫ</td>
        <td width=* align=center>
		<input type=button style=\"width:100px;height:20px\" onclick=\"addExt()\" value=\"Ⱥ>>\" />
	</td>
</tr>
";
idname="row1"
${FLOWEYE} urlfilter listext | while read id name exts theother
do 
echo -n "
   	<tr id=${idname}>
	<td align=center>${id}</td>
	<td align=center><a style=\"color:#0000ff\" href=\"javascript:modifyExt('${id}')\">${name}</a></td>
	<td align=center>${exts}</td>
	<td align=center>
		<a style=\"color:#0000ff\" href=\"javascript:modifyExt('${id}')\">&nbsp;&nbsp;༭&nbsp;&nbsp;</a>
                <a style=\"color:#0000ff\" href=\"javascript:deleteExt('${id}')\">&nbsp;&nbsp;ɾ&nbsp;&nbsp;</a>
	</td>
	</tr>
";
	if [ "${idname}" = "row1" ]; then
		idname="row2"
	else
		idname="row1"
	fi
done 
echo -n "
</table>
</body>
</html>
";