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

@@ -446,6 +446,7 @@ End If
<div class="table-responsive">
</div>
</div>
</div>
<!--/row-->
</div>
@@ -733,123 +734,6 @@ End If
</tbody>
</table>
</div>
<!-- eDNC Special Character Fix Stats -->
<%
'=============================================================================
' eDNC-Fix Installation Stats for this PC (derived from ednclogs)
'=============================================================================
Dim edncSQL, rsEdnc, hasEdnc
hasEdnc = False
edncSQL = "SELECT " & _
"(SELECT version FROM ednclogs WHERE machineid = ? ORDER BY created DESC LIMIT 1) AS version, " & _
"(SELECT MIN(created) FROM ednclogs WHERE machineid = ?) AS first_seen, " & _
"(SELECT MAX(created) FROM ednclogs WHERE machineid = ?) AS last_seen, " & _
"(SELECT COUNT(*) FROM ednclogs WHERE machineid = ? AND action = 'cleaned') AS total_cleaned, " & _
"(SELECT COUNT(*) FROM ednclogs WHERE machineid = ? AND action IN ('failed', 'error')) AS total_failed, " & _
"(SELECT COUNT(*) FROM ednclogs WHERE machineid = ? AND created > DATE_SUB(NOW(), INTERVAL 24 HOUR)) AS events_24h, " & _
"(SELECT MAX(created) FROM ednclogs WHERE machineid = ? AND action = 'cleaned') AS last_cleaned " & _
"FROM DUAL"
Set rsEdnc = ExecuteParameterizedQuery(objConn, edncSQL, Array(machineid, machineid, machineid, machineid, machineid, machineid, machineid))
If Not rsEdnc.EOF And Not IsNull(rsEdnc("first_seen")) Then
hasEdnc = True
%>
<h6 class="mt-4 mb-3"><i class="zmdi zmdi-settings"></i> eDNC Special Character Fix</h6>
<div class="table-responsive">
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="font-weight-bold" width="35%">Version</td>
<td><%= Server.HTMLEncode(rsEdnc("version") & "") %></td>
</tr>
<tr>
<td class="font-weight-bold">First Seen</td>
<td><%= rsEdnc("first_seen") %></td>
</tr>
<tr>
<td class="font-weight-bold">Last Active</td>
<td><%= rsEdnc("last_seen") %></td>
</tr>
<tr>
<td class="font-weight-bold">Files Cleaned</td>
<td><%= rsEdnc("total_cleaned") %></td>
</tr>
<tr>
<td class="font-weight-bold">Files Failed</td>
<td><%= rsEdnc("total_failed") %></td>
</tr>
<tr>
<td class="font-weight-bold">Events (24h)</td>
<td><%= rsEdnc("events_24h") %></td>
</tr>
<tr>
<td class="font-weight-bold">Last Cleaned</td>
<td><%= rsEdnc("last_cleaned") & "" %></td>
</tr>
</tbody>
</table>
</div>
<%
' Show recent log entries
Dim logSQL, rsLog
logSQL = "SELECT filename, action, bytes_removed, created FROM ednclogs " & _
"WHERE machineid = ? AND action IN ('cleaned', 'ok', 'failed', 'error') " & _
"ORDER BY created DESC LIMIT 10"
Set rsLog = ExecuteParameterizedQuery(objConn, logSQL, Array(machineid))
%>
<h6 class="mt-4 mb-2">Recent Activity</h6>
<div class="table-responsive" style="max-height: 300px; overflow-y: auto;">
<table class="table table-sm table-striped mb-0">
<thead class="thead-light">
<tr>
<th>File</th>
<th>Action</th>
<th>Time</th>
</tr>
</thead>
<tbody>
<%
If rsLog.EOF Then
Response.Write "<tr><td colspan='3' class='text-muted text-center'>No recent activity</td></tr>"
Else
Do While Not rsLog.EOF
Dim logAction, logBadge
logAction = rsLog("action") & ""
Select Case logAction
Case "cleaned"
logBadge = "<span class='badge badge-success'>cleaned</span>"
If CLng(rsLog("bytes_removed") & "0") > 0 Then
logBadge = logBadge & " <small class='text-muted'>(" & rsLog("bytes_removed") & " bytes)</small>"
End If
Case "ok"
logBadge = "<span class='badge badge-secondary'>ok</span>"
Case "failed"
logBadge = "<span class='badge badge-danger'>failed</span>"
Case "error"
logBadge = "<span class='badge badge-danger'>error</span>"
Case Else
logBadge = "<span class='badge badge-info'>" & Server.HTMLEncode(logAction) & "</span>"
End Select
Response.Write "<tr>"
Response.Write "<td><code>" & Server.HTMLEncode(rsLog("filename") & "") & "</code></td>"
Response.Write "<td>" & logBadge & "</td>"
Response.Write "<td><small>" & rsLog("created") & "</small></td>"
Response.Write "</tr>"
rsLog.MoveNext
Loop
End If
rsLog.Close
Set rsLog = Nothing
%>
</tbody>
</table>
</div>
<%
End If
rsEdnc.Close
Set rsEdnc = Nothing
%>
</div>
</div>
</div>