<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf not IsNumeric(Request("id"))  Then
	ef=True
	ec="ID应该是数字！"
ElseIf not IsNumeric(Request("ipid"))  Then
	ef=True
	ec="IPID应该是数字！"	
elseIf session("cansetserver")="" Then
	ef=True
	ec="您没有此操作的权限。"
end if
if not ef then%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html8")%>
<%=htmlwrite("html9")%>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0 background="img/midtop4.gif">
  <TBODY>
    <TR>
      <TD width=53 align="left" background="img/midtop1.gif"><strong> 　 </strong><font color="#FFFFFF">─<strong>&gt;</strong></font> </TD>
      <TD width="150"><table height="59"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="7" background="img/midtop.gif">&nbsp;</td>
            <td width="120" align="center" valign="middle" background="img/r3.jpg" id="tableTop1" style="Cursor:hand"><a href="idcjg.asp"><font color="#FFFFFF">机柜信息</font></a></td>
            <td width="5" background="img/midtop2.gif">&nbsp;</td>
          </tr>
      </table></TD>
      <TD width="83">&nbsp;</TD>
      <TD width="83">&nbsp;</TD>
      <TD width="83" align="left">&nbsp;</TD>
      <TD align="left">&nbsp;</TD>
      <TD width=23 align="right"><IMG height=59 
                  src="img/rtop4.jpg" 
                  width=19></TD>
    </TR>
  </TBODY>
</TABLE>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0>
  <TBODY>
    <TR>
      <TD width=19 background="img/midlef.gif" id=rightid>&nbsp;</TD>
      <TD height="300" align="center" vAlign=top bgcolor="#FFFFFF"><br>
	  
<%
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_IDCJG order by jfname,id asc"
if request.Form ("id")<>"" Then Sql="Select * from FreeHost.FreeHost_IDCJG where id='"&Request("id")&"'"
		ds.Open Sql,conn,1,1
If ds.Eof Then%>
机柜列表为空.
<%else%>  
<DIV class="tableborder">
<table width="100%"  border="0" cellspacing="1">
  <tr >
    <td width="9%" height="24" align="center" background="img/tablebg.gif"><font color="#FFFFFF">编号</font></td>
    <td align="center" background="img/tablebg.gif"><font color="#FFFFFF">机房</font></td>
    <td align="center" background="img/tablebg.gif"><font color="#FFFFFF">机柜</font></td>
    <td align="center" background="img/tablebg.gif"><font color="#FFFFFF">说明</font></td>
    <td width="8%" height="24" align="center" background="img/tablebg.gif"><font color="#FFFFFF">IP资源</font></td>
    <td width="9%" align="center" background="img/tablebg.gif"><font color="#FFFFFF">操作</font></td>
  </tr>
<%while not ds.Eof%>

  <tr bgcolor="#E4EAF2">
    <td height="30" align="center"><%=ds("id")%></td>
    <td width="17%" align="center"><%=ds("jfname")%>
	</td>
    <td width="18%" align="center"><%=ds("jgname")%>
	</td>
    <td width="39%" align="center"><%=ds("jginfo")%></td>
    <td align="center"><a href="idcjg.asp?id=<%=ds("id")%>&op=ip">

未用：<%
Set dsip = Server.CreateObject("ADODB.Recordset")	
		Sql="Select count(*) from FreeHost.FreeHost_IDCIP where JGID='"&ds ("id")&"' and PDID=0"
		dsip.Open Sql,conn,1,1
		response.write dsip(0)
%>
总IP：<%Set dsip = Server.CreateObject("ADODB.Recordset")	
		Sql="Select count(*) from FreeHost.FreeHost_IDCIP where JGID='"&ds ("id")&"'"
		dsip.Open Sql,conn,1,1
		response.write dsip(0)%><br>
<%If dsip(0)=0 then%><font color=red>修改</font><%else%>修改<%End if%>
</a></td>
    <td align="center"><a href="idcjg.asp?id=<%=ds("id")%>"><font color=black>修改</font></a></td>
  </tr>
<%
ds.movenext
wend%>
</table>
</div>
<%end if%>
<%if Request("id")<>"" then

	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_IDCJG where id='"&Request("id")&"'"
		ds.Open Sql,conn,1,1
If not ds.Eof Then
jfname=ds("jfname")
jgname=ds("jgname")
jginfo=ds("jginfo")
hardcon=ds("hardcon")
id=ds("id")
JGID=id
end if
end if%>
<%if Request("op")="" then%>
<form name="form1" method="post" action="idcjg-sub.asp" ID="Form1" >
<DIV class="tableborder">
<table width="100%"  border="0" cellspacing="1">
  <tr >
    <td height="24" colspan="2" align="center" background="img/tablebg.gif"><font color="#FFFFFF">机柜信息设置</font></td>
  </tr>
  <tr bgcolor="#E4EAF2">
    <td width="9%" align="right">&nbsp;</td>
    <td width="91%" align="left"><br>      
      机房命名：
        <input name="jfname" type="text" id="jfname" value="<%=jfname%>" size="20" maxlength="50">
        <br>
        机柜命名：
        <input name="jgname" type="text" id="jgname" value="<%=jgname%>" size="20" maxlength="50">
        <br>
        机柜说明：
        <textarea name="jginfo" cols="50" rows="5" id="jginfo"><%=jginfo%></textarea>
        <br>
        硬件情况：
        <textarea name="hardcon" cols="50" rows="5" id="hardcon"><%=hardcon%></textarea>
        <br>
<br>
<%If id="" then%>
<input type="submit" name="Submit" value="添加" ID="Submit1">
<%else%>
<input type="submit" name="modify" value="修改" ID="Submit2">
<input name="id" type="hidden" id="id" value="<%=id%>" size="12">
　　　　　　　　
<input name="delit" type="submit" id="delit" value="删除">
(删除是不可恢复的删除)
<%End if%>
  
<br>
<br></td>
  </tr>
</table></div>
</form>
<%else%><br>
<%
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_IDCIP where JGID='"&Request("id")&"'"
if request.Form ("ipid")<>"" Then Sql="Select * from FreeHost.FreeHost_IDCIP where id='"&Request("ipid")&"'"
		ds.Open Sql,conn,1,1
If ds.Eof Then%>
此机柜IP资源为空.
<%else%>
<DIV class="tableborder">
<table width="100%"  border="0" cellspacing="1">
  <tr >
    <td width="9%" height="24" align="center" background="img/tablebg.gif"><font color="#FFFFFF">编号</font></td>
    <td align="center" background="img/tablebg.gif"><font color="#FFFFFF">IP</font></td>
    <td align="center" background="img/tablebg.gif"><font color="#FFFFFF">所属产品ID</font></td>
    <td width="9%" align="center" background="img/tablebg.gif"><font color="#FFFFFF">操作</font></td>
  </tr>
<%while not ds.Eof%>

  <tr bgcolor="#E4EAF2">
    <td height="30" align="center"><%=ds("id")%></td>
    <td width="40%" align="center"><%=ds("ip")%></td>
    <td width="42%" align="center"><%If ds("PDID")=0 then%>未分配<%else%>
      <a href="handidc1.asp?id=<%=ds("PDID")%>"><%=ds("PDID")%></a>
      <%End if%></td>
    <td align="center"><a href="idcjg.asp?ipid=<%=ds("id")%>&id=<%=JGID%>&op=ip"><font color=black>修改</font></a></td>
  </tr>
<%
ds.movenext
wend%>
</table>
</div>
<%End if%>
<br>
<%if Request("ipid")<>"" then

	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_IDCIP where id='"&Request("ipid")&"'"
		ds.Open Sql,conn,1,1
If not ds.Eof Then
ip=ds("ip")
JGID=ds("JGID")
PDID=ds("PDID")
ipid=ds("id")
end if
end if%>
<form name="form1" method="post" action="idcjg2-sub.asp" ID="Form1" >
<DIV class="tableborder">
<table width="100%"  border="0" cellspacing="1">
  <tr >
    <td height="24" colspan="2" align="center" background="img/tablebg.gif"><font color="#FFFFFF">IP资源设置</font></td>
  </tr>
  <tr bgcolor="#E4EAF2">
    <td width="9%" align="right">&nbsp;</td>
    <td width="91%" align="left"><br>      
<%If ipid<>"" then%>      编号：<%=ipid%><br><%End if%>
        IP：
        <input name="ip" type="text" id="ip" value="<%=ip%>" size="20" maxlength="50">
        (可以批量输入,例如输入192.168.0.1-254就代表输入了255个IP)<BR>
        机柜编号：
        <input name="JGID" type="text" id="JGID" value="<%=JGID%>" size="3" maxlength="50"><br>

<%If PDID<>"" then%>所属服务器编号：
        <input name="PDID" type="text" id="PDID" value="<%=PDID%>" size="3" maxlength="50"><br><%End if%>
<br>
<%If ipid="" then%>
<input type="submit" name="Submit" value="添加" ID="Submit1">
<%else%>
<input type="submit" name="modify" value="修改" ID="Submit2">
<input name="ipid" type="hidden" id="ipid" value="<%=ipid%>" size="12">
　　　　　　　　
<input type="submit" name="delit" value="删除" onClick="return chkForm(this)">
(删除是不可恢复的删除)<script language=JavaScript>
<!--
	function chkForm(theform)
	{
			if(! confirm("请确认是否要删除?\n注意，如果删除是没有办法恢复的。在删除这个机柜前，请您仔细检查，必须是没有任何用户，没有任何产品在使用这个机柜的参数，这样才能删除！"))
				return false;
	}
//-->
</script>  <%End if%>
  
<br>
<br></td>
  </tr>
</table></div>
</form>

<%end if%>

</form>


      </TD>
      <TD width=18 background="img/midri.gif">&nbsp;</TD>
    </TR>
  </TBODY>
</TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
    <TR>
      <TD width=30><IMG height=19 
                  src="img/rb1.jpg" 
                  width=30></TD>
      <TD 
                background=img/rb2.jpg>&nbsp;</TD>
      <TD width=30><IMG height=19 
                  src="img/rb3.jpg" 
                  width=30></TD>
    </TR>
  </TBODY>
</TABLE>
<%=htmlwrite("html10")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
