<%@ 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.flowengine.mode.base.Button"%>
<%@ page import = "zr.zrpower.flowengine.service.FlowSetup"%>
<%@ page import = "zr.zrpower.flowengine.service.FlowControl"%>

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


<!--WEB组件引用-->
<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组件引用结束-->
<SCRIPT LANGUAGE="JavaScript" src="../../../zrsysmanage/script/Public.js"></SCRIPT>
<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>

<%
SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
DateWork dw=new DateWork();
Button[] Bt = null;
FlowSetup FlowPackage= new FlowSetup();
FlowControl FControl = new FlowControl();

%>

<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-->

<!--WEB组件样式和js结束-->
<SCRIPT LANGUAGE="JavaScript" src="../../../zrsysmanage/script/Public.js"></SCRIPT>
 <%
    Bt = FlowPackage.GetButtonList();
    String strshow_data = "";



  //枚举值
     Hashtable Hashtable = new Hashtable();

     Hashtable.put("1","功能按钮");
     Hashtable.put("2","文档按钮");
     Hashtable.put("3","控制按钮");
     Hashtable.put("4","公共功能按钮");
     Hashtable.put("5","公共已分配按钮");
     Hashtable.put("6","流程创建人按钮");


    Hashtable Hashtable1 = new Hashtable();
     Hashtable1.put("1","页面上");
     Hashtable1.put("2","页面下");
     Hashtable1.put("3","页面上和下");


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].getBNAME()+"\",";
			         strshow_data = strshow_data + "\""+Bt[i].getNAME()+"\",";
			         strshow_data = strshow_data + "\""+Hashtable.get(Bt[i].getTYPE())+"\",";
			         strshow_data = strshow_data + "\""+Hashtable1.get(Bt[i].getPOSITION())+"\",";
			          strshow_data = strshow_data + "\""+Bt[i].getICO()+"\",";
			           strshow_data = strshow_data + "\""+Bt[i].getPROPERTY()+"\",";

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

  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 : 'SID'  },
	    {name : 'BNAME'  },
		{name : 'NAME'  },
		{name : 'TYPE'  },
		{name : 'POSITION' },
        {name : 'ICO'  },
        {name : 'PROPERTY'  },
        {name : 'CODE'  }
	],

	recordType : 'array',
	data : show_data
}


var colsOption = [
           {id: 'SID' , header: "<center>编号</center>" , width :150 , align : 'center'  },
           {id: 'BNAME' , header: "<center>按钮名称</center>" , width :150 , align : 'center'  },
           {id: 'NAME' , header: "<center>按钮运转名称</center>" , width :120,  align : 'center'  },
	       {id: 'TYPE' , header: "<center>按钮类别</center>" , width :120 ,align : 'center'  },
	       {id: 'POSITION' , header: "<center>按钮布局分类</center>" , width :100 , align : 'center' },
           {id: 'ICO' , header: "<center>按钮图标</center>" , width :100 , align : 'center' },
           {id: 'PROPERTY' , header: "<center>HTML/TXT值</center>" , width :100 , align : 'center' },
           {id: 'CODE' , header: "<center>排序号</center>" , width :100 , align : 'center' }
];

var gridOption={
	id : grid_demo_id,
	width: "970",
	height: "560",
	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="ButtonList.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:10%;">按钮图标</th>
<th style="width:35%;">HTML/TXT值</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].getBNAME()%></td>
        <td style="text-align:center;"><%=Bt[i].getNAME()%></td>
        <td style="text-align:center;"><%=Hashtable.get(Bt[i].getTYPE())%></td>
        <td ><%=Hashtable1.get(Bt[i].getPOSITION())%></td>
        <td ><%=Bt[i].getICO()%></td>
        <td ><%=Bt[i].getPROPERTY()%></td>
        <td ><%=Bt[i].getCODE()%></td>

     </tr>
     <%
  }
}

 %>
</table>
<br>
</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="ButtonAdd.jsp";
}
function edit(){
    <%if("6".equals(user.getUserWINDOWTYPE())){ %>
        var strID = allvalue;
        if(strID!=""){
           location.href="ButtonEdit.jsp?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="ButtonEdit.jsp?SelectedItems="+strID+" ";
        }
    <%}%>






}

</script>

</HTML>
<%
//清空相关对象
user = null;
userUI = null;
FlowPackage = null;
Bt = null;
FControl = null;
%>
