<%@ page contentType="text/html; charset=GBK" %>
<%@ page import = "zr.zrpower.common.util.SysPreperty" %>
<%@ page import = "zr.zrpower.entity.sys.SessionUser" %>
<%@ page import = "zr.zrpower.entity.sys.BPIP_MENU"%>
<%@ page import = "zr.zrpower.ejb.sys.UIService" %>
<%@ page import = "zr.zrpower.ejb.sys.SecurityService" %>
<%@ page import = "java.util.Hashtable" %>


<HTML>
<%
SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();

BPIP_MENU[] menu = null;
SecurityService MenuService =new SecurityService();

String strPARENTNO = request.getParameter("Menu_No");
String strisLoad = request.getParameter("isLoad");
if (strisLoad == null ){strisLoad="";}
if (strPARENTNO.equals("0"))
{
   strPARENTNO="";
   strisLoad = "no";
}
%>
<HTML>
<HEAD>
<TITLE></TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META http-equiv="Content-Type" content="text/html; charset=GBK">
<link REL="stylesheet" type="text/css" href="../../zrsysmanage/css/<%=user.getUserCSS()%>">
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/script/Public.js"></SCRIPT>

<link rel="stylesheet" type="text/css" media="all" href="../../ZrwebGui/sigma_grid/grid/calendar/calendar-blue.css">
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/calendar/calendar.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/calendar/calendar-setup.js"></script>
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid/grid/gt_grid.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid/grid/skin/vista/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid/grid/skin/pink/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid/grid/skin/mac/skinstyle.css">
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/gt_msg_en.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/gt_const.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/gt_grid_all.js"></script>
<%if("6".equals(user.getUserWINDOWTYPE())){ %>
<LINK type="text/css" rel="stylesheet" href="../../zrsysmanage/html5/css/style_tables.css">
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/html5/script/jquery-2.0.3.min.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/html5/layer/layer.js"></SCRIPT>
<%}%>
<%if (strisLoad.equals("yes")){%>
<SCRIPT LANGUAGE="javascript">
   parent.Left.location.href="Left.jsp?Menu_No=";
</SCRIPT>
 <%}%>

 <%
    //得到查询的记录集
     menu = MenuService.GetMenuList1(strPARENTNO);

     Hashtable Hashtable1 = new Hashtable();
     Hashtable1.put("0","类别");
     Hashtable1.put("1","任务");
     Hashtable Hashtable2 = new Hashtable();
     Hashtable2.put("0","否");
     Hashtable2.put("1","是");

     String strshow_data="";
     if (menu!=null && menu.length>0){
        strshow_data = strshow_data + "[";
        for(int i=0;i<menu.length;i++){
            strshow_data = strshow_data + "[";
            strshow_data = strshow_data + "'"+menu[i].getMENUNO()+"',";
            strshow_data = strshow_data + "'"+menu[i].getMENUNAME()+"',";
            strshow_data = strshow_data + "'"+Hashtable1.get(menu[i].getISPOWER())+"',";
            strshow_data = strshow_data + "'"+menu[i].getURL()+"',";
            strshow_data = strshow_data + "'"+Hashtable2.get(menu[i].getISOPEN())+"',";

            if (i < menu.length-1 )
            {
               strshow_data = strshow_data + "'"+menu[i].getMNCODE()+"'],\r\n";
            }else
            {
               strshow_data = strshow_data + "'"+menu[i].getMNCODE()+"']";
            }
        }

        strshow_data = strshow_data + "]";
    }else
    {
        strshow_data = "null";
    }

%>


<script type="text/javascript" >
var css = "<%=user.getUserCSS()%>";
var skincss = "vista";

if (css=="Blue.css")
{skincss = "vista";}
if (css=="Public.css")
{skincss = "default";}
if (css=="Window.css" || css=="nBlue.css")
{skincss = "mac";}
if (css=="Yellow.css")
{skincss = "pink";}


var grid_demo_id = "myGrid1" ;
var show_data= <%=strshow_data%>;

var dsOption= {

	fields :[
                {name : 'MENUNO'  },
		{name : 'MENUNAME'  },
		{name : 'ISPOWER'  },
		{name : 'URL'  },
		{name : 'ISOPEN' },
                {name : 'MNCODE'  }
	],

	recordType : 'array',
	data : show_data
}



var colsOption = [

           {id: 'MENUNO' , header: "<center>菜单编号</center>" , width :80 , align : 'left'  },
           {id: 'MENUNAME' , header: "<center>菜单名称</center>" , width :180 , align : 'left'  },
           {id: 'ISPOWER' , header: "<center>菜单类型</center>" , width :80,  align : 'center'  },
	   {id: 'URL' , header: "<center>链接地址</center>" , width :180 ,align : 'left'  },
	   {id: 'ISOPEN' , header: "<center>新窗口打开</center>" , width :80 , align : 'center' },
           {id: 'MNCODE' , header: "<center>排序号</center>" , width :70 , align : 'center' }
];


var gridOption={
	id : grid_demo_id,
	width: "99%",
	height: "92%",
	container : 'gridbox',
	replaceContainer : true,
	dataset : dsOption ,
	columns : colsOption,
	pageSize : 2000,
	toolbarContent : null,
        skin : skincss,

        onCellDblClick:function(value, record , cell, row,  colNO, rowNO,columnObj,grid){
           edit();
        },
       showIndexColumn : true
};


<%if(!"6".equals(user.getUserWINDOWTYPE())){ %>
var mygrid=new Sigma.Grid( gridOption );
Sigma.Util.onLoad( Sigma.Grid.render(mygrid));
<%}%>
</script>

</HEAD>
<BODY class="BodyMain">
<form name="recordfrm" action="List.jsp">

<TABLE width="100%" height='100%' cellSpacing='0' cellPadding='0' border='0'><tr><td>
<TABLE height='31' cellSpacing='0' cellPadding='0' border='0'>
 <TR>

  <%if (strPARENTNO.length()>=9){%>
   <%=userUI.ClickButton("编辑菜单","JavaScript:edit();","IcoEdit.gif",user.getUserImage())%>
  <%}else{%>
  <%=userUI.ClickButton("增加菜单","JavaScript:add();","IcoAdd.gif",user.getUserImage())%>
  <%=userUI.ClickButton("编辑菜单","JavaScript:edit();","IcoEdit.gif",user.getUserImage())%>
  <%}%>

  </tr></table></td></tr><tr><td valign="top">

 <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  <div id="mianRole" style="height: 300px;overflow: auto;">
  <table class="bordered" id="html5_table">

<thead>
<tr>
<th style="width:5%;">序号</th>
<th style="width:8%;">菜单编号</th>
<th style="width:30%;">菜单名称</th>
<th style="width:15%;">菜单类型</th>
<th style="width:15%;">链接地址</th>
<th style="width:15%;">新窗口打开</th>
<th style="width:8%;">排序号</th>
</tr>
</thead>
<tbody style="overflow: auto;">
<%
if (menu!=null && menu.length>0){
  for(int i=0;i<menu.length;i++){
     %>
     <tr onclick="click_color(this,'<%=menu[i].getMENUNO() %>');">
        <td style="text-align:center;"><%=i+1 %></td>
        <td style="text-align:center;"><%=menu[i].getMENUNO() %></td>
        <td style="text-align:center;"><%=menu[i].getMENUNAME() %></td>
        <td style="text-align:center;"><%=Hashtable1.get(menu[i].getISPOWER())%></td>
        <td style="text-align:center;"><%=menu[i].getURL() %></td>
        <td style="text-align:center;"><%=Hashtable2.get(menu[i].getISOPEN())%></td>
        <td style="text-align:center;"><%=menu[i].getMNCODE() %></td>


     </tr>

     <%
  }
}

 %>
 </tbody>
</table></div>
  <%}else{ %>
  <div id="gridbox" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:600px;width:800px;" ></div>
  <% }%>


</td></tr></TABLE>

  </form>
</BODY>
<script language="JavaScript" type="text/JavaScript">
<%if("6".equals(user.getUserWINDOWTYPE())){ %>
 var h=$(document.body).height();//浏览器当前窗口文档body的高度
 h=h*1-100;
 $('div').css('height',h);
<%}%>


var allvalue="";
function clickValue(value){
    allvalue=value;
}
function add(){
    location.href="AddFrm.jsp?Menu_No=<%=strPARENTNO%>";
}
function edit(){
    <%if("6".equals(user.getUserWINDOWTYPE())){ %>
        var strID = allvalue;
        if(strID!=""){
           location.href="EditFrm.jsp?SelectedItems="+strID+"&Menu_No=<%=strPARENTNO%>";
        }else{
          layer.alert('请选择要操作的数据!', {icon: 7});
        }
    <%}else{%>
        var allvalue = mygrid.getSelectedRecords()+",0";
        var strID = allvalue.split(",")[0];
        location.href="EditFrm.jsp?SelectedItems="+strID+"&Menu_No=<%=strPARENTNO%>";
    <%}%>

}
</script>
</HTML>
<%
//清空相关对象
user = null;
userUI = null;
menu = null;
MenuService = null;
%>
