<% On Error Resume Next theme = Request.Cookies("theme") If theme = "" Then theme = "bg-theme1" End If ' Get device type and ID from query string Dim deviceType, deviceId deviceType = Trim(Request.Querystring("type")) deviceId = Trim(Request.Querystring("id")) ' Validate inputs If deviceType = "" Or deviceId = "" Or Not IsNumeric(deviceId) Or CLng(deviceId) < 1 Then Response.Redirect("networkdevices.asp") Response.End End If ' Build query based on device type Dim strSQL, rs, tableName, idField, editUrl, listUrl Select Case LCase(deviceType) Case "idf" tableName = "idfs" idField = "idfid" editUrl = "deviceidf.asp?id=" & deviceId listUrl = "networkdevices.asp?filter=IDF" strSQL = "SELECT i.idfid, i.idfname, i.description, i.maptop, i.mapleft, i.isactive, " & _ "NULL AS vendor, NULL AS modelnumber, NULL AS serialnumber, NULL AS ipaddress, NULL AS macaddress, 'IDF' AS devicetype " & _ "FROM idfs i WHERE i.idfid = " & CLng(deviceId) Case "server" tableName = "servers" idField = "serverid" editUrl = "deviceserver.asp?id=" & deviceId listUrl = "networkdevices.asp?filter=Server" strSQL = "SELECT s.*, v.vendor, m.modelnumber, s.serialnumber, s.ipaddress, NULL AS macaddress, NULL AS idfname, 'Server' AS devicetype, " & _ "s.servername AS devicename " & _ "FROM servers s " & _ "LEFT JOIN models m ON s.modelid = m.modelnumberid " & _ "LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _ "WHERE s.serverid = " & CLng(deviceId) Case "switch" tableName = "switches" idField = "switchid" editUrl = "deviceswitch.asp?id=" & deviceId listUrl = "networkdevices.asp?filter=Switch" strSQL = "SELECT s.*, v.vendor, m.modelnumber, s.serialnumber, s.ipaddress, NULL AS macaddress, NULL AS idfname, 'Switch' AS devicetype, " & _ "s.switchname AS devicename " & _ "FROM switches s " & _ "LEFT JOIN models m ON s.modelid = m.modelnumberid " & _ "LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _ "WHERE s.switchid = " & CLng(deviceId) Case "camera" tableName = "cameras" idField = "cameraid" editUrl = "devicecamera.asp?id=" & deviceId listUrl = "networkdevices.asp?filter=Camera" strSQL = "SELECT c.*, v.vendor, m.modelnumber, c.serialnumber, c.ipaddress, c.macaddress, i.idfname, 'Camera' AS devicetype, " & _ "c.cameraname AS devicename " & _ "FROM cameras c " & _ "LEFT JOIN models m ON c.modelid = m.modelnumberid " & _ "LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _ "LEFT JOIN idfs i ON c.idfid = i.idfid " & _ "WHERE c.cameraid = " & CLng(deviceId) Case "accesspoint", "access point" tableName = "accesspoints" idField = "apid" editUrl = "deviceaccesspoint.asp?id=" & deviceId listUrl = "networkdevices.asp?filter=Access Point" strSQL = "SELECT ap.apid, ap.apname AS devicename, ap.modelid, ap.serialnumber, ap.ipaddress, ap.description, ap.maptop, ap.mapleft, ap.isactive, " & _ "v.vendor, m.modelnumber, NULL AS macaddress, NULL AS idfname, NULL AS idfid, 'Access Point' AS devicetype " & _ "FROM accesspoints ap " & _ "LEFT JOIN models m ON ap.modelid = m.modelnumberid " & _ "LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _ "WHERE ap.apid = " & CLng(deviceId) Case Else Response.Redirect("networkdevices.asp") Response.End End Select Set rs = objConn.Execute(strSQL) ' Check if device exists If rs.EOF Then rs.Close Set rs = Nothing Response.Redirect("networkdevices.asp") Response.End End If ' Get device name based on type Dim deviceName Select Case LCase(deviceType) Case "idf" deviceName = rs("idfname") Case "server" deviceName = rs("servername") Case "switch" deviceName = rs("switchname") Case "camera" deviceName = rs("cameraname") Case "accesspoint", "access point" deviceName = rs("devicename") End Select %>
Card image cap
profile-image
<%=Server.HTMLEncode(deviceName)%>
<%If Not IsNull(rs("vendor")) Then Response.Write(Server.HTMLEncode(rs("vendor"))) Else Response.Write(" ") End If%>
<%=Server.HTMLEncode(rs("devicetype"))%>

<%If Not IsNull(rs("description")) Then Response.Write(Server.HTMLEncode(rs("description"))) Else Response.Write(" ") End If%>

Configuration

Type:

Name:

<%If Not IsNull(rs("vendor")) Then%>

Vendor:

Model:

<%End If%> <%If Not IsNull(rs("serialnumber")) And rs("serialnumber") <> "" Then%>

Serial:

<%End If%> <%If Not IsNull(rs("ipaddress")) And rs("ipaddress") <> "" Then%>

IP Address:

<%End If%> <%If Not IsNull(rs("macaddress")) And rs("macaddress") <> "" Then%>

MAC Address:

<%End If%> <%If Not IsNull(rs("idfname")) Then%>

IDF:

<%End If%>

Location:

<%=Server.HTMLEncode(rs("devicetype"))%>

<%=Server.HTMLEncode(deviceName)%>

<%If Not IsNull(rs("vendor")) Then%>

<%=Server.HTMLEncode(rs("vendor"))%>

<%=Server.HTMLEncode(rs("modelnumber"))%>

<%End If%> <%If Not IsNull(rs("serialnumber")) And rs("serialnumber") <> "" Then%>

<%=Server.HTMLEncode(rs("serialnumber"))%>

<%End If%> <%If Not IsNull(rs("ipaddress")) And rs("ipaddress") <> "" Then%>

" target="_blank"><%=Server.HTMLEncode(rs("ipaddress"))%>

<%End If%> <%If Not IsNull(rs("macaddress")) And rs("macaddress") <> "" Then%>

<%=Server.HTMLEncode(rs("macaddress"))%>

<%End If%> <%If Not IsNull(rs("idfname")) Then%>

"><%=Server.HTMLEncode(rs("idfname"))%>

<%End If%>

<%If Not IsNull(rs("maptop")) And Not IsNull(rs("mapleft")) Then%> View on Map <%Else%> Not set <%End If%>

<%If LCase(deviceType) = "server" Then%>
Application tracking not yet implemented for servers
<%End If%>
<% rs.Close Set rs = Nothing objConn.Close %>