<%@ 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.UserService"%>
<%@ page import = "zr.zrpower.entity.sys.BPIP_ROLE"%>
<%@ page import = "zr.zrpower.entity.sys.BPIP_USER"%>
<%@ page import = "zr.zrpower.ejb.sys.UIService" %>
<%@ page import = "zr.zrpower.ejb.sys.SecurityService" %>


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

UserService UserSer = new UserService();
BPIP_ROLE[] role = null;
SecurityService SeService =new SecurityService();

%>
<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>
<%}%>
</HEAD>

<%
    //得到查询的记录集
     role = SeService.GetRoleList1();
     String strshow_data="";
     if (role!=null && role.length>0){
        strshow_data = strshow_data + "[";
        for(int i=0;i<role.length;i++){
            strshow_data = strshow_data + "[";
            strshow_data = strshow_data + "'"+role[i].getROLEID()+"',";
            strshow_data = strshow_data + "'"+role[i].getROLENAME()+"',";

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

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

<script type="text/javascript" >
var css = "<%=user.getUserCSS()%>";
var skincss = "vista";
var swidth = window.screen.width - 200;

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 : 'ROLEID'  },
		{name : 'ROLENAME'  },
		{name : 'DESCRIPTION'  }
	],

	recordType : 'array',
	data : show_data
}



var colsOption = [

           {id: 'ROLEID' , header: "<center>角色编号</center>" , width :80 , align : 'center'  },
           {id: 'ROLENAME' , header: "<center>角色名称</center>" , width :360 , align : 'center'  },
           {id: 'DESCRIPTION' , header: "<center>角色描述</center>" , width :280,  align : 'center'  }
];


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

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

       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="ListRoleUser.jsp">
<%if("6".equals(user.getUserWINDOWTYPE())){ %>
   <br/>
<%} %>

<TABLE width="100%" height='100%' cellSpacing='0' cellPadding='0' border='0'><tr><td>
<TABLE height='31' cellSpacing='0' cellPadding='0' border='0'>
 <TR>
<%=userUI.ClickButton("分配用户","JavaScript:edituser();","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:40%;">角色名称</th>
<th style="width:40%;">角色描述</th>

</tr>
</thead>

<%
if (role!=null && role.length>0){
  for(int i=0;i<role.length;i++){
     %>
     <tr onclick="click_color(this,'<%=role[i].getROLEID() %>');">
        <td style="text-align:center;"><%=i+1 %></td>
        <td style="text-align:center;"><%=role[i].getROLEID() %></td>
        <td style="text-align:center;"><%=role[i].getROLENAME() %></td>
        <td style="text-align:center;"><%=role[i].getDESCRIPTION() %></td>



     </tr>

     <%
  }
}

 %>
</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;
}
<%}%>

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

}

</script>
</HTML>
<%
//清空相关对象
user = null;
userUI = null;
role = null;
SeService = null;
UserSer = null;
%>
