<% On Error Resume Next Dim deviceType, deviceId, mapleft, maptop, deviceName, strSQL, rs deviceType = Trim(Request.Querystring("type")) deviceId = Trim(Request.Querystring("id")) ' Validate inputs If deviceType = "" Or deviceId = "" Or Not IsNumeric(deviceId) Then Response.Write("

Invalid parameters

") Response.End End If ' Build query based on device type ' All network devices now use unified machines table with machinetypeid: ' 16 = Access Point, 17 = IDF, 18 = Camera, 19 = Switch, 20 = Server Select Case LCase(deviceType) Case "idf" strSQL = "SELECT mapleft, maptop, COALESCE(alias, machinenumber) AS devicename FROM machines WHERE machineid = " & CLng(deviceId) & " AND machinetypeid = 17" Case "server" strSQL = "SELECT mapleft, maptop, alias AS devicename FROM machines WHERE machineid = " & CLng(deviceId) & " AND machinetypeid = 20" Case "switch" strSQL = "SELECT mapleft, maptop, alias AS devicename FROM machines WHERE machineid = " & CLng(deviceId) & " AND machinetypeid = 19" Case "camera" strSQL = "SELECT mapleft, maptop, alias AS devicename FROM machines WHERE machineid = " & CLng(deviceId) & " AND machinetypeid = 18" Case "accesspoint", "access point" strSQL = "SELECT mapleft, maptop, alias AS devicename FROM machines WHERE machineid = " & CLng(deviceId) & " AND machinetypeid = 16" Case Else Response.Write("

Unknown device type

") Response.End End Select Set rs = objConn.Execute(strSQL) If Not rs.EOF Then mapleft = rs("mapleft") maptop = rs("maptop") deviceName = rs("devicename") ' Check if location is set If IsNull(mapleft) Or IsNull(maptop) Or mapleft = "" Or maptop = "" Then %>

No location set for this device

<% Else ' Invert Y coordinate for Leaflet maptop = 2550 - maptop %>
<% End If Else Response.Write("

Device not found

") End If rs.Close Set rs = Nothing objConn.Close %>