<% theme = Request.Cookies("theme") IF theme = "" THEN theme="bg-theme1" END IF Dim switchid, isNewRecord switchid = Request.QueryString("id") If switchid = "" Or switchid = "0" Then isNewRecord = True switchid = 0 Else isNewRecord = False End If ' If editing, fetch existing data Dim rs, switchname, modelid, serialnumber, ipaddress, description, maptop, mapleft, isactive Dim vendorname, modelnumber If Not isNewRecord Then Dim strSQL strSQL = "SELECT s.*, m.modelnumber, v.vendor " & _ "FROM switches s " & _ "LEFT JOIN models m ON s.modelid = m.modelnumberid " & _ "LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _ "WHERE s.switchid = " & switchid Set rs = objConn.Execute(strSQL) If rs.EOF Then Response.Write("Switch not found") Response.End End If switchname = rs("switchname") modelid = rs("modelid") serialnumber = rs("serialnumber") ipaddress = rs("ipaddress") description = rs("description") maptop = rs("maptop") mapleft = rs("mapleft") isactive = rs("isactive") vendorname = rs("vendor") modelnumber = rs("modelnumber") rs.Close Set rs = Nothing Else ' New record defaults switchname = "" modelid = "" serialnumber = "" ipaddress = "" description = "" maptop = "" mapleft = "" isactive = 1 ' Active by default for new records vendorname = "" modelnumber = "" End If %>
<%If isNewRecord Then Response.Write("Add Switch") Else Response.Write("Edit Switch: " & Switch.HTMLEncode(switchname))%>

Short name to identify this switch
Select a model or click "New" to add one
IPv4 or IPv6 address
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 switch's position on the network map

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