<%@ 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.UnitService" %>
<%@ page import = "zr.zrpower.entity.sys.BPIP_UNIT" %>
<%@ page import = "zr.zrpower.common.util.StringWork" %>

<HTML>
<%
SessionUser user = (SessionUser)session.getAttribute("userinfo");
BPIP_UNIT[] unit = null;
UnitService unitService = new UnitService();
unit = unitService.GetNewTreeShowList();
String strCode = "";
String strFCode = "";
String strName = "";
StringWork sw = new StringWork();
String Showdata = "";
String strPageName = "Left.jsp";
String strZe = "000000000000";
//得到查询的记录集
if (unit!=null && unit.length>0){

           Showdata = "tree.add('0','-1','单位或部门','"+strPageName+"');\r\n";
           for(int i=0;i<unit.length;i++){
             strCode = unit[i].getUNITID().toString();
             //得到按2位去掉0后的编码
             strFCode = sw.CutLastZero(strCode,2);
             if (strFCode.length()==2)
             {
                strFCode = "0";
             }else
             {
                 strFCode = strFCode.substring(0,strFCode.length()-2);
                 strFCode = strFCode + strZe.substring(0,(12-strFCode.length()));
             }

             strName = unit[i].getUNITNAME().toString();

             Showdata = Showdata + "tree.add('"+strCode+"','"+strFCode+"','"+strName+"','"+strPageName+"');\r\n";

          }
}
%>

<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" href="../ZrwebGui/dtree/dtree.css" type="text/css" />
<script type="text/javascript" src="../ZrwebGui/dtree/dtree.js"></script>
<SCRIPT language="javascript" type="text/javascript">
var mFrame_Left = "1";
function Move_Left(){
  if (mFrame_Left=="1"){
    document.getElementById('divMessage1').style.display='none';
    window.parent.document.getElementById("Menu").cols="14,*";
    mFrame_Left = "0";
  }else{
    document.getElementById('divMessage1').style.display='';
    window.parent.document.getElementById("Menu").cols="200,*";
    mFrame_Left = "1";
  }
}

</SCRIPT>
</HEAD>
<BODY class="BodyMain" <%if(!"6".equals(user.getUserWINDOWTYPE())){ %>background="../zrsysmanage/images/<%=user.getUserImage()%>/databack1.jpg"<%} %>>
<Form name="webform" method="post" action="">
          <table border='0' width="100%"  height="100%" cellspacing="0" cellpadding="0" align=center id="table1">
           <tr>
             <td width="2" ></td>
             <td>
             <%if("6".equals(user.getUserWINDOWTYPE())){ %>
                <DIV id="divMessage1" style="padding-left:0;padding-top:0;width:100%;height:100%;overflow:auto;">
             <%}else{ %>
                <DIV id="divMessage1" style="padding-left:0;padding-top:0;width:100%;height:100%;overflow:auto;background-image: url('<%=SysPreperty.getProperty().AppUrl%>/zrsysmanage/images/<%=user.getUserImage()%>/databack1.jpg')">
                
             <%} %>
             
             <script type="text/javascript">

		var tree = new dTree('tree','../ZrwebGui/dtree/');

                <%=Showdata%>

		document.write(tree);

                tree.s=function(nodeId){ //添加单击事件
                  parent.rightFrame.location.href="UnitMain.jsp?nodeId="+nodeId;
                }

	        </script>


             </DIV>


             </td>
             <%if(!"6".equals(user.getUserWINDOWTYPE())){ %>
             <td class=Pnld width="7" background='<%=SysPreperty.getProperty().AppUrl%>/zrsysmanage/images/<%=user.getUserImage()%>/menu_title_left_back.jpg' onMouseOver="if (document.getElementById('divMessage1').style.display=='none') document.getElementById('left_image').src='<%=SysPreperty.getProperty().AppUrl%>/zrsysmanage/images/<%=user.getUserImage()%>/menu_title_left3.gif'; else document.getElementById('left_image').src='<%=SysPreperty.getProperty().AppUrl%>/zrsysmanage/images/<%=user.getUserImage()%>/menu_title_left1.gif';" onMouseOut="if (document.getElementById('divMessage1').style.display=='none') document.getElementById('left_image').src='<%=SysPreperty.getProperty().AppUrl%>/zrsysmanage/images/<%=user.getUserImage()%>/menu_title_left2.gif'; else document.getElementById('left_image').src='<%=SysPreperty.getProperty().AppUrl%>/zrsysmanage/images/<%=user.getUserImage()%>/menu_title_left.gif';" onclick="if (document.getElementById('divMessage1').style.display=='none'){document.getElementById('divMessage1').style.display='';} else {document.getElementById('divMessage1').style.display='none';}Move_Left();">
                 <img alt="关闭/展开" id="left_image" name="left_image" src='<%=SysPreperty.getProperty().AppUrl%>/zrsysmanage/images/<%=user.getUserImage()%>/menu_title_left.gif' border='0' align='absmiddle'>
             </td>
             <%} %>
          </tr></table>
</form>
</BODY>

</HTML>
<%
user = null;
unit = null;
unitService = null;
%>
