Add USB checkout system and SSO profile page

New Features:
- USB Device checkout/check-in system with barcode scanning
  - displayusb.asp: List all USB devices with status
  - addusb.asp: Add new USB devices via barcode scan
  - checkout_usb.asp/savecheckout_usb.asp: Check out USB to SSO
  - checkin_usb.asp/savecheckin_usb.asp: Check in with wipe confirmation
  - usb_history.asp: Full checkout history with filters
  - api_usb.asp: JSON API for AJAX lookups
- displayprofile.asp: SSO profile page showing user info and USB history
- Date/time format changed to 12-hour (MM/DD/YYYY h:mm AM/PM)
- SSO links in USB history now link to profile page via search

Database:
- New machinetypeid 44 for USB devices
- New usb_checkouts table for tracking checkouts

Cleanup:
- Removed v2 folder (duplicate/old files)
- Removed old debug/test files
- Removed completed migration documentation

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-12-07 11:16:14 -05:00
parent c7834d4b99
commit 65b622c361
1061 changed files with 19034 additions and 213120 deletions

View File

@@ -7,7 +7,7 @@
'=============================================================================
%>
<!--#include file="./includes/sql.asp"-->
<!--#include file="./includes/response.asp"-->
<%
' Universal save endpoint for all network devices
' Saves to unified machines table with appropriate machinetypeid
@@ -20,18 +20,16 @@ isDelete = Trim(Request.Form("delete"))
' Validate device type
If deviceType <> "idf" And deviceType <> "server" And deviceType <> "switch" And deviceType <> "camera" And deviceType <> "accesspoint" Then
Response.Write("<html><body><div style='color:red;'>Error: Invalid device type</div>")
Response.Write("<a href='network_devices.asp'>Back to Network Devices</a></body></html>")
objConn.Close
ShowError "Invalid device type.", "network_devices.asp"
Response.End
End If
' Validate device ID
If deviceId = "" Then deviceId = "0"
If Not IsNumeric(deviceId) Then
Response.Write("<html><body><div style='color:red;'>Error: Invalid device ID</div>")
Response.Write("<a href='network_devices.asp'>Back to Network Devices</a></body></html>")
objConn.Close
ShowError "Invalid device ID.", "network_devices.asp"
Response.End
End If
@@ -99,17 +97,15 @@ End If
' Validate name field (required for all)
If deviceName = "" Then
Response.Write("<html><body><div style='color:red;'>Error: " & deviceDisplayName & " name is required</div>")
Response.Write("<a href='javascript:history.back()'>Go back</a></body></html>")
objConn.Close
ShowError deviceDisplayName & " name is required.", "network_devices.asp"
Response.End
End If
' Validate field lengths
If Len(deviceName) > 100 Or Len(description) > 255 Then
Response.Write("<html><body><div style='color:red;'>Error: Field length exceeded</div>")
Response.Write("<a href='javascript:history.back()'>Go back</a></body></html>")
objConn.Close
ShowError "Field length exceeded.", "network_devices.asp"
Response.End
End If
@@ -136,34 +132,32 @@ macaddress = Trim(Request.Form("macaddress"))
' Handle new model creation
If modelid = "new" Then
Dim newmodelnumber, newvendorid, newmodelnotes, newmodeldocpath, newvendorname
Dim newmodelnumber, newvendorid, newmodelnotes, newmodeldocpath, newvendorname, newmodelmachinetypeid
newmodelnumber = Trim(Request.Form("newmodelnumber"))
newvendorid = Trim(Request.Form("newvendorid"))
newmodelnotes = Trim(Request.Form("newmodelnotes"))
newmodeldocpath = Trim(Request.Form("newmodeldocpath"))
newvendorname = Trim(Request.Form("newvendorname"))
newmodelmachinetypeid = Trim(Request.Form("newmodelmachinetypeid"))
' Validate required fields for new model
If newmodelnumber = "" Then
Response.Write("<html><body><div style='color:red;'>Error: Model number is required</div>")
Response.Write("<a href='javascript:history.back()'>Go back</a></body></html>")
objConn.Close
ShowError "Model number is required.", "network_devices.asp"
Response.End
End If
If newvendorid = "" Then
Response.Write("<html><body><div style='color:red;'>Error: Vendor is required for new model</div>")
Response.Write("<a href='javascript:history.back()'>Go back</a></body></html>")
objConn.Close
ShowError "Vendor is required for new model.", "network_devices.asp"
Response.End
End If
' Handle new vendor creation (nested)
If newvendorid = "new" Then
If newvendorname = "" Then
Response.Write("<html><body><div style='color:red;'>Error: Vendor name is required</div>")
Response.Write("<a href='javascript:history.back()'>Go back</a></body></html>")
objConn.Close
ShowError "Vendor name is required.", "network_devices.asp"
Response.End
End If
@@ -179,10 +173,11 @@ If modelid = "new" Then
On Error Resume Next
cmdNewVendor.Execute
If Err.Number <> 0 Then
Response.Write("<html><body><div style='color:red;'>Error creating vendor: " & Server.HTMLEncode(Err.Description) & "</div>")
Response.Write("<a href='javascript:history.back()'>Go back</a></body></html>")
Dim vendorErr
vendorErr = Err.Description
Set cmdNewVendor = Nothing
objConn.Close
ShowError "Error creating vendor: " & vendorErr, "network_devices.asp"
Response.End
End If
@@ -198,23 +193,29 @@ If modelid = "new" Then
' Insert new model using parameterized query
Dim sqlNewModel, cmdNewModel
sqlNewModel = "INSERT INTO models (modelnumber, vendorid, notes, documentationpath, isactive) VALUES (?, ?, ?, ?, 1)"
sqlNewModel = "INSERT INTO models (modelnumber, vendorid, machinetypeid, notes, documentationpath, isactive) VALUES (?, ?, ?, ?, ?, 1)"
Set cmdNewModel = Server.CreateObject("ADODB.Command")
cmdNewModel.ActiveConnection = objConn
cmdNewModel.CommandText = sqlNewModel
cmdNewModel.CommandType = 1
cmdNewModel.Parameters.Append cmdNewModel.CreateParameter("@modelnumber", 200, 1, 50, newmodelnumber)
cmdNewModel.Parameters.Append cmdNewModel.CreateParameter("@vendorid", 3, 1, , CLng(newvendorid))
If newmodelmachinetypeid <> "" Then
cmdNewModel.Parameters.Append cmdNewModel.CreateParameter("@machinetypeid", 3, 1, , CLng(newmodelmachinetypeid))
Else
cmdNewModel.Parameters.Append cmdNewModel.CreateParameter("@machinetypeid", 3, 1, , Null)
End If
cmdNewModel.Parameters.Append cmdNewModel.CreateParameter("@notes", 200, 1, 500, newmodelnotes)
cmdNewModel.Parameters.Append cmdNewModel.CreateParameter("@documentationpath", 200, 1, 500, newmodeldocpath)
On Error Resume Next
cmdNewModel.Execute
If Err.Number <> 0 Then
Response.Write("<html><body><div style='color:red;'>Error creating model: " & Server.HTMLEncode(Err.Description) & "</div>")
Response.Write("<a href='javascript:history.back()'>Go back</a></body></html>")
Dim modelErr
modelErr = Err.Description
Set cmdNewModel = Nothing
objConn.Close
ShowError "Error creating model: " & modelErr, "network_devices.asp"
Response.End
End If
@@ -249,9 +250,8 @@ If deviceType = "camera" Then
' Validate required fields for new IDF
If newidfname = "" Then
Response.Write("<html><body><div style='color:red;'>Error: IDF name is required</div>")
Response.Write("<a href='javascript:history.back()'>Go back</a></body></html>")
objConn.Close
ShowError "IDF name is required.", "network_devices.asp"
Response.End
End If
@@ -270,10 +270,11 @@ If deviceType = "camera" Then
On Error Resume Next
cmdNewIdf.Execute
If Err.Number <> 0 Then
Response.Write("<html><body><div style='color:red;'>Error creating IDF: " & Server.HTMLEncode(Err.Description) & "</div>")
Response.Write("<a href='javascript:history.back()'>Go back</a></body></html>")
Dim idfErr
idfErr = Err.Description
Set cmdNewIdf = Nothing
objConn.Close
ShowError "Error creating IDF: " & idfErr, "network_devices.asp"
Response.End
End If
@@ -289,9 +290,8 @@ If deviceType = "camera" Then
' Validate required idfid for cameras
If idfid = "" Or Not IsNumeric(idfid) Or CLng(idfid) < 1 Then
Response.Write("<html><body><div style='color:red;'>Error: IDF location is required for cameras</div>")
Response.Write("<a href='javascript:history.back()'>Go back</a></body></html>")
objConn.Close
ShowError "IDF location is required for cameras.", "network_devices.asp"
Response.End
End If
@@ -345,10 +345,11 @@ If deviceId = "0" Then
On Error Resume Next
cmdDevice.Execute
If Err.Number <> 0 Then
Response.Write("<html><body><div style='color:red;'>Error saving device: " & Server.HTMLEncode(Err.Description) & "</div>")
Response.Write("<a href='javascript:history.back()'>Go back</a></body></html>")
Dim saveErr
saveErr = Err.Description
Set cmdDevice = Nothing
objConn.Close
ShowError "Error saving device: " & saveErr, "network_devices.asp"
Response.End
End If
Set cmdDevice = Nothing
@@ -382,10 +383,11 @@ Else
On Error Resume Next
cmdDevice.Execute
If Err.Number <> 0 Then
Response.Write("<html><body><div style='color:red;'>Error updating device: " & Server.HTMLEncode(Err.Description) & "</div>")
Response.Write("<a href='javascript:history.back()'>Go back</a></body></html>")
Dim updateErr
updateErr = Err.Description
Set cmdDevice = Nothing
objConn.Close
ShowError "Error updating device: " & updateErr, "network_devices.asp"
Response.End
End If
Set cmdDevice = Nothing
@@ -472,7 +474,7 @@ If deviceType = "camera" And idfid <> "" And Not IsNull(idfRelationshipTypeId) T
Set cmdInsertRel = Nothing
End If
' Success - redirect to list
' Success - show success message
objConn.Close
Response.Redirect(redirectUrl)
ShowSuccess deviceDisplayName & " saved successfully.", redirectUrl, deviceDisplayName
%>