Fix network device description/machinenotes display and edit

- Fix ADO cursor issue where reading rs("description") twice caused
  empty values (IsNull check consumed the field value)
- Change all device pages to read description field once using
  `description = rs("description") & ""` pattern
- Add deviceDescription variable in displaydevice.asp
- Fix machinetypeid mapping: IDF=17, Camera=18 (was swapped)
- Add model dropdown fix to include currently assigned model
- Add server application tracking feature
- Various other improvements and fixes

Files affected:
- displaydevice.asp, displaylocationdevice.asp
- deviceaccesspoint.asp, deviceserver.asp, deviceswitch.asp
- devicecamera.asp, deviceidf.asp
- savenetworkdevice.asp, networkdevices.asp

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-12-17 13:47:56 -05:00
parent a5b4013949
commit a4096ace94
25 changed files with 1744 additions and 355 deletions

View File

@@ -23,11 +23,11 @@
' If editing, fetch existing data
Dim rs, switchname, modelid, serialnumber, ipaddress, fqdn, description, maptop, mapleft, isactive
Dim vendorname, modelnumber
Dim vendorname, modelnumber, logicmonitorurl
If Not isNewRecord Then
Dim strSQL
strSQL = "SELECT mac.machineid, mac.alias AS switchname, mac.modelnumberid AS modelid, " & _
"mac.serialnumber, mac.fqdn, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
"mac.serialnumber, mac.fqdn, mac.logicmonitorurl, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
"m.modelnumber, v.vendor, c.address AS ipaddress " & _
"FROM machines mac " & _
"LEFT JOIN models m ON mac.modelnumberid = m.modelnumberid " & _
@@ -45,8 +45,9 @@
If Not IsNull(rs("modelid")) Then modelid = rs("modelid") Else modelid = ""
If Not IsNull(rs("serialnumber")) Then serialnumber = rs("serialnumber") Else serialnumber = ""
If Not IsNull(rs("ipaddress")) Then ipaddress = rs("ipaddress") Else ipaddress = ""
If Not IsNull(rs("fqdn")) Then fqdn = rs("fqdn") Else fqdn = ""
If Not IsNull(rs("description")) Then description = rs("description") Else description = ""
If Not IsNull(rs("fqdn")) Then fqdn = rs("fqdn") & "" Else fqdn = ""
If Not IsNull(rs("logicmonitorurl")) Then logicmonitorurl = rs("logicmonitorurl") & "" Else logicmonitorurl = ""
description = rs("description") & ""
If Not IsNull(rs("maptop")) Then maptop = rs("maptop") Else maptop = ""
If Not IsNull(rs("mapleft")) Then mapleft = rs("mapleft") Else mapleft = ""
If Not IsNull(rs("isactive")) Then isactive = rs("isactive") Else isactive = 1
@@ -62,6 +63,7 @@
serialnumber = ""
ipaddress = ""
fqdn = ""
logicmonitorurl = ""
description = ""
maptop = ""
mapleft = ""
@@ -134,12 +136,13 @@
<select name="modelid" id="modelid" class="form-control">
<option value="">-- Select Model --</option>
<%
Dim strSQL2, rsModels
' Filter models to only show Switch models (machinetypeid = 19)
Dim strSQL2, rsModels, currentModelId
' Show Switch models (machinetypeid = 19) plus currently assigned model
If IsNumeric(modelid) Then currentModelId = CLng(modelid) Else currentModelId = 0
strSQL2 = "SELECT m.modelnumberid, m.modelnumber, v.vendor " & _
"FROM models m " & _
"INNER JOIN vendors v ON m.vendorid = v.vendorid " & _
"WHERE m.isactive = 1 AND m.machinetypeid = 19 " & _
"WHERE m.isactive = 1 AND (m.machinetypeid = 19 OR m.modelnumberid = " & currentModelId & ") " & _
"ORDER BY v.vendor, m.modelnumber"
Set rsModels = objConn.Execute(strSQL2)
Do While Not rsModels.EOF
@@ -300,6 +303,19 @@
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label">Logic Monitor URL</label>
<div class="col-sm-9">
<input type="url" name="logicmonitorurl" class="form-control"
value="<%=Server.HTMLEncode(logicmonitorurl)%>"
maxlength="512"
placeholder="e.g., https://company.logicmonitor.com/santaba/uiv3/...">
<small class="form-text text-muted">
Link to this device in Logic Monitor (optional)
</small>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label">Description</label>
<div class="col-sm-9">