#!/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 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">
<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">
<META HTTP-EQUIV=\"Cache-Control\" content=\"no-cache\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"/img/p2p.css\" />
<link rel=\"stylesheet\" type=\"text/css\" href=\"/img/dtree.css\" />
<script type=\"text/javascript\" src=\"/img/dtree.js\"></script>
<script type=\"text/javascript\">
function openurl(url)
{
        window.parent.document.getElementById(\"content\").src = url;
}
function appinfo(appid, appname)
{
	var url;
	url = \"/cgi-bin/Monitor/appview_topip?bridge=0&appid=\" + appid +
	      \"&appname=\" + appname;
        window.parent.document.getElementById(\"content\").src = url;
}
function groupinfo(grpid, grpname)
{
	var url;
	url = \"/cgi-bin/Monitor/grpview?title=ӦЭ->\" + grpname + \"&group=\" + grpid;
        window.parent.document.getElementById(\"content\").src = url;
}
</script>
</head>
";
RAMDISK="/usr/ramdisk"
if [ -f ${RAMDISK}/PG.conf ]; then
        . ${RAMDISK}/PG.conf
        PGPATH="${RAMDISK}"
else
        . /etc/PG.conf
fi
FLOWEYE=${PGPATH}/bin/floweye
. ${PGPATH}/etc/panabit.inf

echo -n "
<body>
<div style=\"position:absolute;top:6px\">
<script type=\"text/javascript\">
	d = new dTree('d');
	d.add(0, -1, 'ͳ');
	d.add(10, 0, 'ϵͳſ', '','','','','', true);
	d.add(100001, 10, 'ſ', \"javascript:openurl('/cgi-bin/Monitor/group_stat?bridge=0')\");
        d.add(100008, 10, 'ϵͳϢ', \"javascript:openurl('/cgi-bin/Monitor/info_system?title=ϵͳſ->ϵͳϢ')\");
	
	d.add(11, 0, 'ϵͳ', '','','','','', true);
        d.add(100002, 11, 'ӿ', \"javascript:openurl('/cgi-bin/Monitor/if_stat')\");
        d.add(200000, 11, '');
";
        bridgeidx=200001
        ${FLOWEYE} bridge list format=long | while read bdg ifin ifout bwin bwout tmp1 tmp2 brname
        do
                nextidx=`expr ${bridgeidx} + ${bdg}` 

echo -n "
		d.add(${nextidx}, 200000,'${brname}',\"javascript:openurl('/cgi-bin/Monitor/group_stat?bridge=${bdg}&bdgname=${brname}')\");
";	done 
echo -n "
        d.add(100003, 11, '·', \"javascript:openurl('/cgi-bin/Monitor/vlink_list')\");
        d.add(100004, 11, 'WAN·', \"javascript:openurl('/cgi-bin/Monitor/proxy_stat')\");
	d.add(100005, 11, 'TopӦ', \"javascript:openurl('/cgi-bin/Monitor/app_topn?title=ϵͳſ->TopӦ')\");
	d.add(100006, 11, 'Topû', \"javascript:openurl('/cgi-bin/Monitor/ip_topn?title=ϵͳſ->Topû')\");
	d.add(100007, 11, 'ƶն', \"javascript:openurl('/cgi-bin/Monitor/mob_stat')\");
"; if [ "${PANABIT_USER}" != "guest" ]; then 
echo -n "
	d.add(40000, 0, 'ǰ', '','','','','', true);
	d.add(400001,40000, '', \"javascript:openurl('/cgi-bin/Monitor/policy_stat?title=ǰ->Ʋ')\");
	d.add(400002,40000, 'ӿ', \"javascript:openurl('/cgi-bin/Monitor/conlimit_stat?title=ǰ->Ʋ')\");
	d.add(400003,40000, 'HTTPܿ', \"javascript:openurl('/cgi-bin/Monitor/urlfilter_stat?title=ǰ->HTTPܿز')\");
	d.add(400004,40000, 'DNSܿ', \"javascript:openurl('/cgi-bin/Route/dns_listrule')\");
	d.add(400005,40000, 'MAC', \"javascript:openurl('/cgi-bin/Monitor/ipmac_stat')\");
"; fi 
echo -n "
	document.write(d);
</script>
</div>
</body>
</html>
";