<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*" %>
<%@ page import="com.gx.webpage.engine.menupage.designdbengine.factory.*" %>
<%@ page import="com.gx.webpage.engine.menupage.designdbengine.valueobject.*" %>
<%@ page import="com.gx.webpage.framework.valueobject.*" %>
<%@ page import="com.gx.webpage.engine.menupage.designdbengine.api.*" %>
<%@ page import="com.gx.webpage.framework.util.inoutformat.DataBean" %>
<%
    String errStr = "";
    String script = "";
		String powerType = DataBean.getStr(request, "powerType");
    try
    {
        UserInfoCtxModel uicm = new UserInfoCtxModel();
        uicm.setUserId("cc");
				EbiMenuMgr delegate = MenuFactory.getInstance().getEbiMenuMgr();
				Collection col = new ArrayList();
				if(powerType!=null && powerType.trim().length()>0){
					uicm.setNeedAcl(true);
					uicm.setAclType(uicm.ACLTYPE_ROW);
					uicm.setRowCatPath("com.cc.menu");
					Collection colPerIds = new ArrayList();
					if(powerType.trim().equals("add")){
						colPerIds.add("add");
					}
					if(powerType.trim().equals("search")){
						colPerIds.add("search");
					}
					uicm.setRowColPerId(colPerIds);
					col = delegate.findAllSysMenus(true,uicm);
				}else{
					col = delegate.findAllSysMenus(false,uicm);
				}
        Iterator it = col.iterator();
        script += "function showTree(){ d = new dTree('d'); d.add(0,-1,'菜单列表');";
        String scriptB = '"' + "setSelect('menuUuid','menuName','";
        String scriptT = "')" + '"';
        String commer = "' , '";
        String puuid = "";
        it = col.iterator();
        while(it.hasNext())
        {
            SysMenuModel model = (SysMenuModel)it.next();
            puuid = model.getParentUuid();
            if(puuid == null || puuid.trim().length() == 0)
            {
                puuid = "0";
            }
            script += "d.add('" + model.getUuid()
                        + "','" + puuid + "','"
                        + model.getName()
                        + "'," + scriptB + model.getUuid() + commer + model.getName() + scriptT + ",'"
                        + model.getName()
                        + "',true);";
        }
        script += "d.draw(); }";
    }
    catch(Exception ex)
    {
      errStr = DataBean.getErrStr(ex);
      return;
    }
%>
<html>
    <head>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="./../../../webpage/common/css/common.css" rel="StyleSheet"  type="text/css" />
<script language="javascript" src="./../../../webpage/common/engine/constant.js"></script>
<script language="JScript.Encode" src="./../../../webpage/common/engine/common.js"></script>
<script language="javascript">
<%= script%>
</script>
    </head>
<body class="tree">
<input class="txtInput" type="text" width="100%" name="menuName" size = "60" disabled="true" value="">
<input type="hidden" name="menuUuid" value="-1">
<div align="left" class="dtree">
<script language="javascript">
<!--
    showTree();
//-->
</script>
</div>
<p class="information">
<input class="butACTION" type="button" value="确　　定" name="butSubmit" onclick="doOK('menuUuid');">
<input class="butACTION" type="button" value="取　　消" name="butCancel" onclick="doCancel();">
</body>
</html>
