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:
@@ -9,19 +9,21 @@
|
||||
<head>
|
||||
<link rel="stylesheet" href="./style.css" type="text/css">
|
||||
<!--#include file="./includes/sql.asp"-->
|
||||
<!--#include file="./includes/response.asp"-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="page">
|
||||
<%
|
||||
' Get and validate all inputs
|
||||
Dim modelid, serialnumber, ipaddress, fqdn, printercsfname, printerwindowsname, machineid, maptop, mapleft
|
||||
Dim modelid, serialnumber, ipaddress, fqdn, printercsfname, printerwindowsname, printerpin, machineid, maptop, mapleft
|
||||
modelid = Trim(Request.Form("modelid"))
|
||||
serialnumber = Trim(Request.Form("serialnumber"))
|
||||
ipaddress = Trim(Request.Form("ipaddress"))
|
||||
fqdn = Trim(Request.Form("fqdn"))
|
||||
printercsfname = Trim(Request.Form("printercsfname"))
|
||||
printerwindowsname = Trim(Request.Form("printerwindowsname"))
|
||||
printerpin = Trim(Request.Form("printerpin"))
|
||||
machineid = Trim(Request.Form("machineid"))
|
||||
maptop = Trim(Request.Form("maptop"))
|
||||
mapleft = Trim(Request.Form("mapleft"))
|
||||
@@ -39,39 +41,34 @@
|
||||
|
||||
' Validate required fields
|
||||
If modelid = "" Then
|
||||
Response.Write("<div class='alert alert-danger'>Error: Model is required.</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Error: Model is required.", "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
If modelid <> "new" And Not IsNumeric(modelid) Then
|
||||
Response.Write("<div class='alert alert-danger'>Error: Invalid model ID.</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Error: Invalid model ID.", "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
' Machine ID is now optional - only validate if provided
|
||||
If machineid <> "" And Not IsNumeric(machineid) Then
|
||||
Response.Write("<div class='alert alert-danger'>Error: Invalid machine ID.</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Error: Invalid machine ID.", "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
If serialnumber = "" Or ipaddress = "" Or printerwindowsname = "" Then
|
||||
Response.Write("<div class='alert alert-danger'>Error: Required fields missing.</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Error: Required fields missing.", "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
' Validate field lengths
|
||||
If Len(serialnumber) > 100 Or Len(fqdn) > 255 Or Len(printercsfname) > 50 Or Len(printerwindowsname) > 255 Then
|
||||
Response.Write("<div class='alert alert-danger'>Error: Field length exceeded.</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Error: Field length exceeded.", "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
@@ -91,9 +88,8 @@
|
||||
rsCheck.Close
|
||||
Set rsCheck = Nothing
|
||||
Set cmdCheck = Nothing
|
||||
Response.Write("<div class='alert alert-danger'>Error: A printer with IP address '" & Server.HTMLEncode(ipaddress) & "' already exists.</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Error: A printer with IP address '" & Server.HTMLEncode(ipaddress) & "' already exists.", "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
End If
|
||||
@@ -105,39 +101,34 @@
|
||||
' Handle new model creation
|
||||
If modelid = "new" Then
|
||||
If Len(newmodelnumber) = 0 Then
|
||||
Response.Write("<div class='alert alert-danger'>New model number is required</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "New model number is required", "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
If Len(newvendorid) = 0 Then
|
||||
Response.Write("<div class='alert alert-danger'>Vendor is required for new model</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Vendor is required for new model", "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
If Len(newmodelnumber) > 255 Or Len(newmodelnotes) > 255 Or Len(newmodeldocpath) > 255 Then
|
||||
Response.Write("<div class='alert alert-danger'>Model field length exceeded</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Model field length exceeded", "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
' Handle new vendor creation (nested)
|
||||
If newvendorid = "new" Then
|
||||
If Len(newvendorname) = 0 Then
|
||||
Response.Write("<div class='alert alert-danger'>New vendor name is required</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "New vendor name is required", "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
If Len(newvendorname) > 50 Then
|
||||
Response.Write("<div class='alert alert-danger'>Vendor name too long</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Vendor name too long", "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
@@ -154,10 +145,9 @@
|
||||
cmdNewVendor.Execute
|
||||
|
||||
If Err.Number <> 0 Then
|
||||
Response.Write("<div class='alert alert-danger'>Error creating new vendor: " & Server.HTMLEncode(Err.Description) & "</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
Set cmdNewVendor = Nothing
|
||||
objConn.Close
|
||||
ShowError "Error creating new vendor: " & Server.HTMLEncode(Err.Description), "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
Set cmdNewVendor = Nothing
|
||||
@@ -193,10 +183,9 @@
|
||||
cmdNewModel.Execute
|
||||
|
||||
If Err.Number <> 0 Then
|
||||
Response.Write("<div class='alert alert-danger'>Error creating new model: " & Server.HTMLEncode(Err.Description) & "</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
Set cmdNewModel = Nothing
|
||||
objConn.Close
|
||||
ShowError "Error creating new model: " & Server.HTMLEncode(Err.Description), "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
Set cmdNewModel = Nothing
|
||||
@@ -240,8 +229,16 @@
|
||||
machineIdValue = Null
|
||||
End If
|
||||
|
||||
strSQL = "INSERT INTO printers (modelid, serialnumber, ipaddress, fqdn, printercsfname, printerwindowsname, machineid, maptop, mapleft, isactive) " & _
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 1)"
|
||||
' Handle optional PIN - use NULL if not provided
|
||||
Dim printerpinValue
|
||||
If printerpin <> "" Then
|
||||
printerpinValue = printerpin
|
||||
Else
|
||||
printerpinValue = Null
|
||||
End If
|
||||
|
||||
strSQL = "INSERT INTO printers (modelid, serialnumber, ipaddress, fqdn, printercsfname, printerwindowsname, printerpin, machineid, maptop, mapleft, isactive) " & _
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1)"
|
||||
|
||||
On Error Resume Next
|
||||
Set cmdPrinter = Server.CreateObject("ADODB.Command")
|
||||
@@ -254,16 +251,16 @@
|
||||
cmdPrinter.Parameters.Append cmdPrinter.CreateParameter("@fqdn", 200, 1, 255, fqdn)
|
||||
cmdPrinter.Parameters.Append cmdPrinter.CreateParameter("@printercsfname", 200, 1, 50, printercsfname)
|
||||
cmdPrinter.Parameters.Append cmdPrinter.CreateParameter("@printerwindowsname", 200, 1, 255, printerwindowsname)
|
||||
cmdPrinter.Parameters.Append cmdPrinter.CreateParameter("@printerpin", 200, 1, 10, printerpinValue)
|
||||
cmdPrinter.Parameters.Append cmdPrinter.CreateParameter("@machineid", 3, 1, , machineIdValue)
|
||||
cmdPrinter.Parameters.Append cmdPrinter.CreateParameter("@maptop", 3, 1, , maptopValue)
|
||||
cmdPrinter.Parameters.Append cmdPrinter.CreateParameter("@mapleft", 3, 1, , mapleftValue)
|
||||
cmdPrinter.Execute
|
||||
|
||||
If Err.Number <> 0 Then
|
||||
Response.Write("<div class='alert alert-danger'>Error inserting printer: " & Server.HTMLEncode(Err.Description) & "</div>")
|
||||
Response.Write("<a href='addprinter.asp'>Go back</a>")
|
||||
Set cmdPrinter = Nothing
|
||||
objConn.Close
|
||||
ShowError "Error inserting printer: " & Server.HTMLEncode(Err.Description), "addprinter.asp"
|
||||
Response.End
|
||||
End If
|
||||
Set cmdPrinter = Nothing
|
||||
@@ -284,11 +281,9 @@
|
||||
objConn.Close
|
||||
|
||||
If CLng(newPrinterId) > 0 Then
|
||||
%>
|
||||
<meta http-equiv="refresh" content="0; url=./displayprinter.asp?printerid=<%=Server.HTMLEncode(newPrinterId)%>">
|
||||
<%
|
||||
ShowSuccess "Printer added successfully.", "displayprinter.asp?printerid=" & newPrinterId, "printer details"
|
||||
Else
|
||||
Response.Write("Error: Printer was not added successfully.")
|
||||
ShowError "Printer was not added successfully.", "addprinter.asp"
|
||||
End If
|
||||
%>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user