<%@ page contentType="text/html; charset=GBK" %>
<%@ page import = "zr.zrpower.common.util.SysPreperty" %>
<%@ page import = "zr.zrpower.entity.sys.SessionUser" %>
<%@ page import = "zr.zrpower.ejb.sys.UIService" %>
<%@ page import = "zr.zrpower.queryengine.mode.QUERY_CONFIG_BUTTON"%>
<%@ page import = "zr.zrpower.queryengine.service.QueryButton"%>

<%@ page import = "zr.zrpower.common.util.DateWork" %>
<%@ page import = "java.lang.Object"%>

<HTML>
<%
SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
DateWork dw=new DateWork();
QUERY_CONFIG_BUTTON[] Bt = null;
QueryButton QueryBtMsg =new QueryButton();
int intPageSize;
intPageSize = user.getUserPageSize();

String FID = request.getParameter("FID");
if (FID == null){FID="0";}

%>
<HTML>
<HEAD>
<TITLE></TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META http-equiv="Content-Type" content="text/html; charset=GBK">
<LINK type="text/css" rel="stylesheet" href="../../zrsysmanage/css/<%=user.getUserCSS()%>">
<!--WEB组件样式和js-->
<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>
<!--WEB组件样式和js结束-->
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/script/Public.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>
<%}%>
 <%
 //得到查询的记录集

     Bt = QueryBtMsg.GetButtonList(FID);

     String strshow_data="";
     if (Bt!=null && Bt.length>0){

        strshow_data = strshow_data + "[";
        for(int i=0;i<Bt.length;i++){

            strshow_data = strshow_data + "[";

            strshow_data = strshow_data + "\""+Bt[i].getID()+"\",";
            strshow_data = strshow_data + "\""+Bt[i].getNAME()+"\",";
            strshow_data = strshow_data + "\""+Bt[i].getRUNNAME()+"\",";
            strshow_data = strshow_data + "\""+Bt[i].getICO()+"\",";
            strshow_data = strshow_data + "\""+Bt[i].getPATHORJS()+"\",";
                strshow_data = strshow_data + "\""+Bt[i].getROLEIDS()+"\",";
               if (i <Bt.length-1 )
         {
            strshow_data = strshow_data + "\""+Bt[i].getBCODE()+"\"],\r\n";
         }else
         {
            strshow_data = strshow_data + "\""+Bt[i].getBCODE()+"\"]";
         }

        }

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

  %>
</HEAD>
<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 : 'ID'  },
		{name : 'NAME'  },
		{name : 'RUNNAME'  },
		{name : 'ICO' },
        {name : 'PATHORJS'  },
        {name : 'ROLEIDS'  },
        {name : 'BCODE'  }

	],

	recordType : 'array',
	data : show_data
}



var colsOption = [

           {id: 'ID' , header: "<center>编号</center>" , width :80 , align : 'left'  },
           {id: 'NAME' , header: "<center>按钮名称</center>" , width :200,  align : 'center'  },
	   {id: 'RUNNAME' , header: "<center>按钮运转名称</center>" , width :180 ,align : 'center'  },
	   {id: 'ICO' , header: "<center>图标</center>" , width :100 , align : 'center' },
           {id: 'PATHORJS' , header: "<center>链接地址或js函数</center>" , width :150 , align : 'center' },
            {id: 'ROLEIDS' , header: "<center>所属角色编号</center>" , width :120 , align : 'center' },
             {id: 'BCODE' , header: "<center>排序号</center>" , width :80 , 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>
<BODY class="BodyMain">
<form name="recordfrm" action="List.jsp">
<TABLE height='31' cellSpacing='0' cellPadding='0' border='0'>
 <TR>
 <%=userUI.ClickButton("增加按钮","JavaScript:add();","IcoAdd.gif",user.getUserImage())%>
 <%=userUI.ClickButton("编辑按钮","JavaScript:edit();","IcoEdit.gif",user.getUserImage())%>
  </tr></table>

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

<thead>
<tr>
<th style="width:4%;">序号</th>
<th style="width:10%;">编码</th>
<th style="width:15%;">按钮名称</th>
<th style="width:10%;">按钮运转名称</th>
<th style="width:10%;">图标</th>
<th style="width:30%;">链接地址或js函数</th>
<th style="width:15%;">所属角色编号</th>
<th style="width:8%;">排序号</th>

</tr>
</thead>

<%
if (Bt!=null && Bt.length>0){
  for(int i=0;i<Bt.length;i++){
     %>
     <tr onclick="click_color(this,'<%=Bt[i].getID() %>');">
        <td style="text-align:center;"><%=i+1%></td>
        <td style="text-align:center;"><%=Bt[i].getID() %></td>
        <td style="text-align:center;"><%=Bt[i].getNAME() %></td>
        <td ><%=Bt[i].getRUNNAME() %></td>
        <td ><%=Bt[i].getICO() %></td>
        <td ><%=Bt[i].getPATHORJS() %></td>
        <td ><%=Bt[i].getROLEIDS() %></td>
        <td ><%=Bt[i].getBCODE() %></td>
     </tr>
     <%
  }
}

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


  </form>
</BODY>
<script language="JavaScript" type="text/JavaScript">
<!--
var allvalue="";
function clickValue(value){
    allvalue=value;
}
function add(){
    location.href="Add.jsp?FID=<%=FID%>";
}
function edit(){
<%if("6".equals(user.getUserWINDOWTYPE())){ %>
        var strID = allvalue;
        if(strID!=""){
           location.href="Edit.jsp?FID=<%=FID%>&SelectedItems="+strID;
        }else{
            layer.alert('请先选择编辑的记录!', {icon: 7});
        }
    <%}else{%>
        var allvalue = mygrid.getSelectedRecords()+",0";
   var strID = allvalue.split(",")[0];
      if (strID==null||strID=="")
    {alert("请先选择编辑的记录!");
    }else
    {location.href="Edit.jsp?FID=<%=FID%>&SelectedItems="+strID;}
    <%}%>

}
//--
</script>
</HTML>
