<% theme = Request.Cookies("theme") IF theme = "" THEN theme="bg-theme1" END IF Dim serverid, isNewRecord serverid = Request.QueryString("id") If serverid = "" Or serverid = "0" Then isNewRecord = True serverid = 0 Else isNewRecord = False End If ' If editing, fetch existing data Dim rs, servername, modelid, serialnumber, ipaddress, fqdn, description, maptop, mapleft, isactive Dim vendorname, modelnumber If Not isNewRecord Then Dim strSQL strSQL = "SELECT mac.machineid, mac.alias AS servername, mac.modelnumberid AS modelid, " & _ "mac.serialnumber, mac.fqdn, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _ "m.modelnumber, v.vendor, c.address AS ipaddress " & _ "FROM machines mac " & _ "LEFT JOIN models m ON mac.modelnumberid = m.modelnumberid " & _ "LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _ "LEFT JOIN communications c ON mac.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1 " & _ "WHERE mac.machineid = " & serverid & " AND mac.machinetypeid = 20" Set rs = objConn.Execute(strSQL) If rs.EOF Then Response.Write("Server not found") Response.End End If ' Convert all text fields to string to avoid type mismatch with HTMLEncode If Not IsNull(rs("servername")) Then servername = rs("servername") & "" Else servername = "" If Not IsNull(rs("modelid")) Then modelid = rs("modelid") Else modelid = "" If Not IsNull(rs("serialnumber")) Then serialnumber = rs("serialnumber") & "" Else serialnumber = "" If Not IsNull(rs("ipaddress")) Then ipaddress = rs("ipaddress") & "" Else ipaddress = "" If Not IsNull(rs("fqdn")) Then fqdn = rs("fqdn") & "" Else fqdn = "" If Not IsNull(rs("description")) Then description = rs("description") & "" Else description = "" If Not IsNull(rs("maptop")) Then maptop = rs("maptop") Else maptop = "" If Not IsNull(rs("mapleft")) Then mapleft = rs("mapleft") Else mapleft = "" If Not IsNull(rs("isactive")) Then isactive = rs("isactive") Else isactive = 1 If Not IsNull(rs("vendor")) Then vendorname = rs("vendor") & "" Else vendorname = "" If Not IsNull(rs("modelnumber")) Then modelnumber = rs("modelnumber") & "" Else modelnumber = "" rs.Close Set rs = Nothing Else ' New record defaults servername = "" modelid = "" serialnumber = "" ipaddress = "" fqdn = "" description = "" maptop = "" mapleft = "" isactive = 1 ' Active by default for new records vendorname = "" modelnumber = "" End If %>
<%If isNewRecord Then Response.Write("Add Server") Else Response.Write("Edit Server: " & Server.HTMLEncode(servername))%>

Short name to identify this server
Select a model or click "New" to add one
IPv4 or IPv6 address
Fully Qualified Domain Name (optional)
Optional: Purpose, rack location, or other notes
>
Inactive devices are hidden from most lists and the network map
<%If maptop <> "" And mapleft <> "" Then Response.Write("Current position: X=" & mapleft & ", Y=" & maptop) Else Response.Write("No position set - click button to select") End If%>
Click to select this server's position on the network map

Cancel <%If Not isNewRecord Then%> <%End If%>
<% objConn.Close %>