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


<HTML>
<%
SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
BPIP_TABLESPACE[] SP = null;
TableSpaceService Space = new TableSpaceService();
String sum = Space.SumTableSpace();
//得到查询的记录集
   SP = Space.GetBpipTableSpaceList("");

   String strshow_data="";
     if (SP!=null && SP.length>0){
        strshow_data = strshow_data + "[";
        for(int i=0;i<SP.length;i++){
            strshow_data = strshow_data + "[";
            strshow_data = strshow_data + "'"+SP[i].getID()+"',";
            strshow_data = strshow_data + "'"+SP[i].getCHINESENAME()+"',";

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

        strshow_data = strshow_data + "]";
    }else
    {
        strshow_data = "null";
    }
%>
<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()%>">
<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>
<%}%>
<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 : 'CHINESENAME'  },
		{name : 'DESCRIPTION'  }
	],

	recordType : 'array',
	data : show_data
}



var colsOption = [

           {id: 'ID' , header: "<center>编号</center>" , width :80 , align : 'center'  },
           {id: 'CHINESENAME' , header: "<center>表分类名称</center>" , width :260 , align : 'center'  },
           {id: 'DESCRIPTION' , header: "<center>表分类描述</center>" , width :260,  align : 'center'  }
];


var gridOption={
	id : grid_demo_id,
	width: "800",
	height: "260",
	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">

<%if("6".equals(user.getUserWINDOWTYPE())){ %>
   <div id="mianRole" style="height: 90%;overflow: auto;">
   数据库一共有表分类<%=sum%>个；<font color="red"">说明：当表分类下建有表时不能删除。</font>
    <hr />
   <a style="margin-top: -15px" class="btn1 btn-medium btn-blue btn-radius" href="#" onclick="JavaScript:add();">增加分类表</a>
   <a style="margin-top: -15px" class="btn1 btn-medium btn-blue btn-radius" href="#" onclick="JavaScript:edit();">编辑分类表</a>

  <table class="bordered" id="html5_table">

<thead>
<tr>
<th style="width:5%;">序号</th>
<th style="width:40%;">表分类名称</th>
<th style="width:40%;">表分类描述</th>

</tr>
</thead>

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

     <%
  }
}

 %>
</table></div>

<%}else{ %>
<table border='0' height="229" width="100%" background="../../zrsysmanage/images/<%=user.getUserImage()%>/databack2.jpg" cellspacing="0" cellpadding="0" align=center>
       <tr>
          <td  width="40%"></td>
          <td width="42%"></td>
          <td width="18%"></td>
        </tr>
       <tr>
          <td  width="40%"></td>
          <td width="42%"></td>
          <td width="18%"></td>
        </tr>
         <tr>
          <td  width="40%"></td>
          <td width="42%" valign="bottom">数据库一共有表分类<%=sum%>个<br><br>
          说明：当表分类下建有表时不能删除。
          </td>
          <td width="18%"></td>
        </tr>
        <tr><td width="40%"></td>
           <td width="42%" valign="bottom" align="left">
          <br>
           <table cellspacing="0" cellpadding="0" border='0'>
            <tr><td height='22'><a href=JavaScript:add(); title='增加表分类'><img border='0' align='absmiddle' src='../../zrsysmanage/images/<%=user.getUserImage()%>/dataadd.gif'>&nbsp;增加表分类</a></td>
               <td height='22'><a href=JavaScript:edit(); title='编辑表分类'><img border='0' align='absmiddle' src='../../zrsysmanage/images/<%=user.getUserImage()%>/dataedit.gif'>&nbsp;编辑表分类</a></td>
           </tr>
          </table>
      </td>
           <td width="18%"></td>
        </tr>
      </table>

      <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">
<!--
<%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(){

  <%if("6".equals(user.getUserWINDOWTYPE())){%>
  layer.open({
  type: 2,
  area: ['500px', '230px'],
  fix: false, //不固定
  maxmin: false,//是否可以最大化
  content: 'SpaceAdd.jsp'
});
  <%}else{%>
  var url="SpaceAdd.jsp";
  var name="PopWindow";
  var ShowPopWindow = null;
  var status="toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=440,height=270";
  ShowPopWindow = window.open(url,name,status);
  ShowPopWindow.moveTo(280,180);
  ShowPopWindow.focus();
  <%}%>

}
function edit(){
   <%if("6".equals(user.getUserWINDOWTYPE())){ %>
        var strID = allvalue;
        if(strID!=""){
            layer.open({
              type: 2,
              area: ['500px', '230px'],
              fix: false, //不固定
              maxmin: false,//是否可以最大化
              content: 'SpaceEdit.jsp?SelectedItems='+strID //zrsysmanage/DbManage/
            });
        }else{
            layer.alert('请选择要操作的数据!', {icon: 7});
        }

    <%}else{%>
        var allvalue = mygrid.getSelectedRecords()+",0";
        var strID = allvalue.split(",")[0];
        var url="SpaceEdit.jsp?SelectedItems="+strID;
      var name="PopWindow";
      var ShowPopWindow = null;
      var status="toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=440,height=270";
      ShowPopWindow = window.open(url,name,status);
      ShowPopWindow.moveTo(280,180);
      ShowPopWindow.focus();
    <%}%>
}
//-->
</script>
</HTML>
<%
//清空相关对象
user = null;
userUI = null;
Space = null;
SP = null;
%>
