<%@ 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"%>
<%@ page import = "zr.zrpower.dbmanage.service.TableService"%>
<%@ page import = "zr.zrpower.common.util.DateWork" %>
<%@ page import = "java.lang.Object"%>

<%
SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
%>
<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()%>">
<LINK type="text/css" rel="stylesheet" href="../../zrsysmanage/css/tree.css">
</HEAD>
<%
  TableSpaceService TableSpace = new TableSpaceService();
  TableService Table = new TableService();
  BPIP_TABLESPACE[] sub = TableSpace.GetBpipTableSpaceList("");           //获取所有的子系统
  BPIP_TABLE[] fun = Table.GetBpipTableList("");          //获取所有的功能
  String maxid = TableSpace.GetSpaceId();


  //html5用到
  String userClass="windowimg";
  String zdid=request.getParameter("zdid");
  if(!"6".equals(user.getUserImage())){
     userClass=user.getUserImage();
  }

 %>
<BODY class="BodyMain" onLoad="swapimg('<%=maxid%>','','sub1','fold1','open1');" background="../../zrsysmanage/images/<%=userClass%>/databack1.jpg">

 <DIV id="divMessage" style='position:absolute;width:100%;height:100%;overflow:auto'>
  <table>
 <tr>
    <td valign="top">

<% //根节点 %>
<DIV>
  <IMG src="../../zrsysmanage/images/<%=userClass%>/datatree1.gif" align="absmiddle">数据库表空间</DIV>
<%
   if (sub!=null){
      for ( int i=0; i<sub.length;i++){
          %>
          <DIV><%if(sub[i].getID().equals(maxid)){%><IMG align=absMiddle src="../../zrsysmanage/images/<%=userClass%>/PuLineB.gif" border=0 id=sub<%=Integer.toString(i)%>
            onclick=swapimg('<%=maxid%>','<%=sub[i].getID()%>',sub<%=Integer.toString(i)%>,fold<%=Integer.toString(i)%>,open<%=Integer.toString(i)%>)><%} else {%><IMG align=absMiddle src="../../zrsysmanage/images/<%=userClass%>/PuLineA.gif" border=0 id=sub<%=Integer.toString(i)%>
            onclick=swapimg('<%=maxid%>','<%=sub[i].getID()%>',sub<%=Integer.toString(i)%>,fold<%=Integer.toString(i)%>,open<%=Integer.toString(i)%>)><%}%><IMG src="../../zrsysmanage/images/<%=userClass%>/datatree2.gif" align=absMiddle  border=0
              id=open<%=Integer.toString(i)%> class="B"><a onclick=swapimg('<%=maxid%>','<%=sub[i].getID()%>',sub<%=Integer.toString(i)%>,fold<%=Integer.toString(i)%>,open<%=Integer.toString(i)%>)><%=sub[i].getCHINESENAME()%></a></DIV>
              <DIV class=on id=fold<%=Integer.toString(i)%>>
                <%
                if(fun!=null){
                for (int j=0; j<fun.length;j++){
                  if (fun[j].getTABLESPACE().equals(sub[i].getID())){
                  String maxid1 = Table.GetTableId(fun[j].getTABLESPACE());
                    %>
                    <DIV class="off"><NOBR><%if(sub[i].getID().equals(maxid)){%><IMG align=absMiddle src="../../zrsysmanage/images/<%=userClass%>/PuLineH.gif"><%} else {%><IMG align=absMiddle src="../../zrsysmanage/images/<%=userClass%>/PuLineG.gif"><%}%>
                     <%if(fun[j].getTABLEID().equals(maxid1)){%><IMG align=absMiddle src="../../zrsysmanage/images/<%=userClass%>/PuLineF.gif"><%} else {%><IMG align=absMiddle src="../../zrsysmanage/images/<%=userClass%>/PuLineE.gif"><%}%><IMG align=absMiddle src="../../zrsysmanage/images/<%=userClass%>/datatree4.gif"  border=0><A onclick=javascript:seleTask('<%=fun[j].getTABLENAME()%>')><%=fun[j].getCHINESENAME()%></A><br/>
                    </NOBR></DIV>
                      <%
                      }
                    }
                }
                %></DIV><%
              }
  }
%>
<%//末节点%>

	</td>
  </tr>
</table>
</DIV>

</BODY>
<%if("6".equals(user.getUserWINDOWTYPE())){ %>
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/html5/script/jquery-2.0.3.min.js"></SCRIPT>
<%}%>
<script language="JavaScript" type="text/JavaScript">
<!--
function swapimg(maxid,id,myimgNum,secNum,folderimg){

	    if (secNum.className=="off")
		{
                    secNum.className="on";
	     	    if(id==maxid){
                      myimgNum.src="../../zrsysmanage/images/<%=userClass%>/PuLineB.gif";
                    }else{
                      myimgNum.src="../../zrsysmanage/images/<%=userClass%>/PuLineA.gif";
                    }
	     	    folderimg.src="../../zrsysmanage/images/<%=userClass%>/datatree2.gif";
		}
	    else
		{
		    secNum.className="off";
	     	    if(id==maxid){
                      myimgNum.src="../../zrsysmanage/images/<%=userClass%>/PuLineD.gif";
                    }else{
                      myimgNum.src="../../zrsysmanage/images/<%=userClass%>/PuLineC.gif";
                    }
	     	    folderimg.src="../../zrsysmanage/images/<%=userClass%>/datatree3.gif";
		}
	  }
 function swapimg2(maxid,intid,myimgNum,secNum,folderimg){

	    if (secNum.className=="off")
		{
                    secNum.className="on";
	     	     if(intid==maxid){
                      myimgNum.src="../../zrsysmanage/images/<%=userClass%>/PuLineB.gif";
                    }else{
                      myimgNum.src="../../zrsysmanage/images/<%=userClass%>/PuLineA.gif";
                    }
	     	    folderimg.src="../../zrsysmanage/images/<%=userClass%>/datatree2.gif";
    		}
	    else
		{
		    secNum.className="off";
	     	     if(intid==maxid){
                      myimgNum.src="../../zrsysmanage/images/<%=userClass%>/PuLineD.gif";
                    }else{
                      myimgNum.src="../../zrsysmanage/images/<%=userClass%>/PuLineC.gif";
                    }
	     	    folderimg.src="../../zrsysmanage/images/<%=userClass%>/datatree2.gif";
          	}
	  }
function seleTask(TableName)
{

    <%if("6".equals(user.getUserImage())){%>
    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
      parent.$('#<%=zdid%>').val(TableName);
      parent.layer.close(index);
    <%}else{%>
      window.returnValue=TableName;
      window.close();
    <%}%>
}
//-->
</script>
</HTML>
<%
//清空相关对象
user = null;
userUI = null;
TableSpace = null;
Table = null;
sub = null;
fun = null;
%>
