<% 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 Select Case LCase(deviceType) Case "idf" strSQL = "SELECT mapleft, maptop, idfname AS devicename FROM idfs WHERE idfid = " & CLng(deviceId) Case "server" strSQL = "SELECT mapleft, maptop, servername AS devicename FROM servers WHERE serverid = " & CLng(deviceId) Case "switch" strSQL = "SELECT mapleft, maptop, switchname AS devicename FROM switches WHERE switchid = " & CLng(deviceId) Case "camera" strSQL = "SELECT mapleft, maptop, cameraname AS devicename FROM cameras WHERE cameraid = " & CLng(deviceId) Case "accesspoint", "access point" strSQL = "SELECT mapleft, maptop, apname AS devicename FROM accesspoints WHERE apid = " & CLng(deviceId) 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 %>