```
---
## network_map.asp Integration
### Current State
Currently queries `machines` table filtering for infrastructure machine types.
### New Approach
Query both machines AND infrastructure tables:
```vbscript
<%
' Get infrastructure devices
strSQL = "SELECT 'IDF' as type, idfid as id, idfname as name, NULL as model, NULL as vendor, " & _
"maptop, mapleft, 'IDF' as device_type " & _
"FROM idfs WHERE isactive = 1 AND maptop IS NOT NULL " & _
"UNION ALL " & _
"SELECT 'Server' as type, serverid as id, description as name, m.modelnumber as model, v.vendor, " & _
"s.maptop, s.mapleft, 'Server' as device_type " & _
"FROM servers s " & _
"LEFT JOIN models m ON s.modelid = m.modelnumberid " & _
"LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _
"WHERE s.isactive = 1 AND s.maptop IS NOT NULL " & _
"UNION ALL " & _
"SELECT 'Switch' as type, switchid as id, description as name, m.modelnumber as model, v.vendor, " & _
"sw.maptop, sw.mapleft, 'Switch' as device_type " & _
"FROM switches sw " & _
"LEFT JOIN models m ON sw.modelid = m.modelnumberid " & _
"LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _
"WHERE sw.isactive = 1 AND sw.maptop IS NOT NULL " & _
"UNION ALL " & _
"SELECT 'Camera' as type, cameraid as id, description as name, m.modelnumber as model, v.vendor, " & _
"c.maptop, c.mapleft, 'Camera' as device_type " & _
"FROM cameras c " & _
"LEFT JOIN models m ON c.modelid = m.modelnumberid " & _
"LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _
"WHERE c.isactive = 1 AND c.maptop IS NOT NULL"
Set rs = objConn.Execute(strSQL)
' Output JSON for map markers
Response.Write("const devices = [")
Do While Not rs.EOF
Response.Write("{")
Response.Write("type: '" & rs("device_type") & "', ")
Response.Write("id: " & rs("id") & ", ")
Response.Write("name: '" & Replace(rs("name") & "", "'", "\'") & "', ")
Response.Write("model: '" & Replace(rs("model") & "", "'", "\'") & "', ")
Response.Write("vendor: '" & Replace(rs("vendor") & "", "'", "\'") & "', ")
Response.Write("x: " & rs("mapleft") & ", ")
Response.Write("y: " & rs("maptop"))
Response.Write("},")
rs.MoveNext
Loop
Response.Write("];")
%>
```
---
## Summary: Why This Approach?
**Hierarchical relationships** - Cameras/switches belong to IDFs
**Type-specific fields** - MAC address for cameras, idfname for IDFs
**Flexible** - Can add more fields per type later
**Clean data model** - Proper normalization
**Unified list view** - See all infrastructure in one place
**Type-specific edit** - Appropriate fields per device type
**Map integration** - All devices can be mapped
**Total Files:** 7 ASP files (1 list + 4 detail + 1 add + 1 save)
---
**Next Step:** Run enhanced migration script to add `idfid` to switches/servers, then create the 7 pages.