<%@ page  language="java" contentType="text/html; charset=GBK" %>
<%@ page import = "zr.zrpower.common.util.SysPreperty" %>
<%@ page import = "zr.zrpower.entity.sys.SessionUser" %>
<%@ page import = "zr.zrpower.collectionengine.service.ConfigService"%>
<%@ page import = "zr.zrpower.dbmanage.service.FieldService"%>
<%@ page import = "zr.zrpower.ejb.sys.UIService"%>
<%@ page import = "zr.zrpower.collectionengine.*" %>


<%

SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
CollectionInfo[] configs = null;
ConfigService configservice = new ConfigService();
FieldService FieldService = new FieldService();
int intPageSize = user.getUserPageSize();
%>
<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()%>">
<!--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" type="text/javascript"></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>
<%}%>
 <%
  String currentPage = request.getParameter("page");

  if(currentPage == null)
  {currentPage = "1";}

  String sqlStr = "",sqlCount = "";
  sqlCount = "Select count(*) as RCount  From COLL_DOC_CONFIG";


  //得到查询的记录集
  configs = configservice.GetListConfig(Integer.parseInt(currentPage),1000);
   String strshow_data="";
     if (configs!=null && configs.length>0){

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

            strshow_data = strshow_data + "[";

            strshow_data = strshow_data + "\""+configs[i].getID()+"\",";
            strshow_data = strshow_data + "\""+configs[i].getDOCNAME()+"\",";
            strshow_data = strshow_data + "\""+configs[i].getTEMPLAET()+"\",";

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

        }

        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 : 'DOCNAME'  },
		{name : 'TEMPLAET'  },
		{name : 'MAINTABLE' }

	],

	recordType : 'array',
	data : show_data
}



var colsOption = [

           {id: 'ID' , header: "<center>编号</center>" , width :80 , align : 'left'  },
           {id: 'DOCNAME' , header: "<center>文档名称</center>" , width :360,  align : 'center'  },
	   {id: 'TEMPLAET' , header: "<center>模板</center>" , width :160 ,align : 'center'  },
	   {id: 'MAINTABLE' , header: "<center>绑定数据表</center>" , width :160 , 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){

           msg();
        },

       showIndexColumn : true
};

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

</script>
<BODY class="BodyMain">
<form name="recordfrm"  action="List.jsp">
<input type="hidden" name="page">


<TABLE cellSpacing='0' cellPadding='0' border='0'>
 <TR><td  style="width:2px;height:38px;"></td>

  <%=userUI.ClickButton("增加配置","JavaScript:add();","IcoAdd.gif",user.getUserImage())%>
  <%=userUI.ClickButton("详细信息","JavaScript:msg();","Icosub.gif",user.getUserImage())%>

  </tr></table>

<%if("6".equals(user.getUserWINDOWTYPE())){ %>

  <div id="mianRole" style="height: 98%;overflow: auto;">
  <table class="bordered" id="html5_table">

<thead>
<tr>
<th style="width:5%;">编号</th>
<th style="width:20%;">文档名称</th>
<th style="width:20%;">模板</th>
<th style="width:20%;">绑定数据表</th>

</tr>
</thead>
<%
if (configs!=null && configs.length>0){
  for(int i=0;i<configs.length;i++){
     %>
     <tr onclick="click_color(this,'<%=configs[i].getID() %>');">
        <td style="text-align:center;"><%=configs[i].getID() %></td>
        <td style="text-align:center;"><%=configs[i].getDOCNAME() %></td>
        <td style="text-align:center;"><%=configs[i].getTEMPLAET() %></td>
        <td style="text-align:center;"><%=configs[i].getMAINTABLE() %></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";
}
function msg(){
    <%if("6".equals(user.getUserWINDOWTYPE())){ %>
        var strID = allvalue;
        if(strID!=""){
           location.href="MainInfo.jsp?SelectedItems="+strID;
        }else{
          parent.layer.alert('请选择要操作的数据!', {icon: 7});
        }
    <%}else{%>
         var allvalue = mygrid.getSelectedRecords()+",0";
    var strID = allvalue.split(",")[0];
    if (strID==null||strID=="")
    {alert("请先选择编辑的记录!");
    }else
    {location.href="MainInfo.jsp?SelectedItems="+strID;}
    <%}%>


}
//-->
</script>
</HTML>
<%
//清空相关对象
user = null;
userUI = null;
configs = null;
configservice = null;
FieldService = null;
%>
