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:
@@ -43,6 +43,27 @@ Dim currentPCStatus, recentFilter, deviceTypeFilter, sel
|
||||
currentPCStatus = Request.QueryString("pcstatus")
|
||||
recentFilter = Request.QueryString("recent")
|
||||
deviceTypeFilter = Request.QueryString("devicetype")
|
||||
|
||||
' Check for specialized PCs (CMM, Wax Trace, Measuring Tool) without equipment relationships
|
||||
Dim rsUnlinked, unlinkedCount
|
||||
unlinkedCount = 0
|
||||
Set rsUnlinked = objConn.Execute("SELECT COUNT(*) as cnt FROM machines m " & _
|
||||
"WHERE m.machinetypeid IN (41, 42, 43) AND m.isactive = 1 " & _
|
||||
"AND NOT EXISTS (SELECT 1 FROM machinerelationships mr WHERE (mr.machineid = m.machineid OR mr.related_machineid = m.machineid) AND mr.relationshiptypeid = 3 AND mr.isactive = 1)")
|
||||
If Not rsUnlinked.EOF Then
|
||||
unlinkedCount = CLng(rsUnlinked("cnt") & "")
|
||||
End If
|
||||
rsUnlinked.Close
|
||||
Set rsUnlinked = Nothing
|
||||
|
||||
If unlinkedCount > 0 Then
|
||||
%>
|
||||
<div class="alert alert-warning" role="alert" style="margin-bottom:15px;">
|
||||
<i class="zmdi zmdi-alert-triangle"></i> <strong><%=unlinkedCount%> specialized PC(s)</strong> (CMM, Wax Trace, or Measuring Tool) need equipment relationships.
|
||||
<a href="displaypcs.asp?needsrelationship=1" class="alert-link">View them</a>
|
||||
</div>
|
||||
<%
|
||||
End If
|
||||
%>
|
||||
<div style="display:flex; gap:10px; flex-wrap:wrap; align-items:center;">
|
||||
<select id="deviceTypeFilter" class="btn btn-secondary btn-sm" onchange="updateFilter('devicetype', this.value)">
|
||||
@@ -71,7 +92,7 @@ Set rsStatus = Nothing
|
||||
<option value="">All Time</option>
|
||||
<option value="7"<% If recentFilter = "7" Then Response.Write(" selected") End If%>>Last 7 Days</option>
|
||||
</select>
|
||||
<% If currentPCStatus <> "" Or recentFilter <> "" Or deviceTypeFilter <> "" Then %>
|
||||
<% If currentPCStatus <> "" Or recentFilter <> "" Or deviceTypeFilter <> "" Or Request.QueryString("needsrelationship") <> "" Then %>
|
||||
<a href="displaypcs.asp" class="btn btn-outline-secondary btn-sm">
|
||||
<i class="zmdi zmdi-close"></i> Clear
|
||||
</a>
|
||||
@@ -89,30 +110,38 @@ Set rsStatus = Nothing
|
||||
<th scope="col">Serial</th>
|
||||
<th scope="col">Model</th>
|
||||
<th scope="col">OS</th>
|
||||
<th scope="col">Equipment</th>
|
||||
<th scope="col">VNC</th>
|
||||
<th scope="col">WinRM</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<%
|
||||
' Build query based on filters
|
||||
Dim pcStatusFilter, recentDaysFilter, deviceTypeFilterSQL, whereClause
|
||||
Dim pcStatusFilter, recentDaysFilter, deviceTypeFilterSQL, needsRelationshipFilter, whereClause
|
||||
Dim displayName, hasVnc, vncHost, hasWinrm
|
||||
pcStatusFilter = Request.QueryString("pcstatus")
|
||||
recentDaysFilter = Request.QueryString("recent")
|
||||
deviceTypeFilterSQL = Request.QueryString("devicetype")
|
||||
needsRelationshipFilter = Request.QueryString("needsrelationship")
|
||||
|
||||
' Base query with LEFT JOINs to show all PCs
|
||||
strSQL = "SELECT m.machineid, m.hostname, m.serialnumber, m.machinenumber, m.machinestatusid, " & _
|
||||
"m.modelnumberid, m.osid, m.loggedinuser, m.lastupdated, " & _
|
||||
"m.modelnumberid, m.osid, m.loggedinuser, m.lastupdated, m.isvnc, m.iswinrm, " & _
|
||||
"vendors.vendor, models.modelnumber, operatingsystems.operatingsystem, " & _
|
||||
"c.address AS ipaddress, c.macaddress, " & _
|
||||
"machinestatus.machinestatus " & _
|
||||
"machinestatus.machinestatus, " & _
|
||||
"eq.machineid AS equipment_id, eq.machinenumber AS equipment_number " & _
|
||||
"FROM machines m " & _
|
||||
"LEFT JOIN models ON m.modelnumberid = models.modelnumberid " & _
|
||||
"LEFT JOIN vendors ON models.vendorid = vendors.vendorid " & _
|
||||
"LEFT JOIN operatingsystems ON m.osid = operatingsystems.osid " & _
|
||||
"LEFT JOIN communications c ON c.machineid = m.machineid AND c.isprimary = 1 " & _
|
||||
"LEFT JOIN machinestatus ON m.machinestatusid = machinestatus.machinestatusid " & _
|
||||
"WHERE m.isactive = 1 AND m.machinetypeid IN (33, 34, 35) "
|
||||
"LEFT JOIN machinerelationships mr ON (mr.machineid = m.machineid OR mr.related_machineid = m.machineid) AND mr.isactive = 1 AND mr.relationshiptypeid = 3 " & _
|
||||
"LEFT JOIN machines eq ON (eq.machineid = mr.related_machineid OR eq.machineid = mr.machineid) AND eq.machineid <> m.machineid AND eq.machinetypeid < 33 " & _
|
||||
"WHERE m.isactive = 1 AND m.machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)"
|
||||
|
||||
' Apply filters
|
||||
whereClause = ""
|
||||
@@ -131,6 +160,12 @@ Set rsStatus = Nothing
|
||||
whereClause = whereClause & "AND (models.modelnumber LIKE '%OptiPlex%' OR models.modelnumber LIKE '%Tower%' OR models.modelnumber LIKE '%Micro%') "
|
||||
End If
|
||||
|
||||
' Filter for specialized PCs needing equipment relationships
|
||||
If needsRelationshipFilter = "1" Then
|
||||
whereClause = whereClause & "AND m.machinetypeid IN (41, 42, 43) " & _
|
||||
"AND NOT EXISTS (SELECT 1 FROM machinerelationships mr WHERE (mr.machineid = m.machineid OR mr.related_machineid = m.machineid) AND mr.relationshiptypeid = 3 AND mr.isactive = 1) "
|
||||
End If
|
||||
|
||||
strSQL = strSQL & whereClause & "GROUP BY m.machineid ORDER BY m.machinenumber ASC, m.hostname ASC"
|
||||
|
||||
set rs = objconn.Execute(strSQL)
|
||||
@@ -138,8 +173,7 @@ Set rsStatus = Nothing
|
||||
|
||||
%>
|
||||
<tr>
|
||||
<td><a href="./displaypc.asp?pcid=<%Response.Write(rs("machineid"))%>" title="Click to Show PC Details"><%
|
||||
Dim displayName
|
||||
<td><a href="./displaypc.asp?machineid=<%Response.Write(rs("machineid"))%>" title="Click to Show PC Details"><%
|
||||
If IsNull(rs("hostname")) Or rs("hostname") = "" Then
|
||||
displayName = rs("serialnumber")
|
||||
Else
|
||||
@@ -150,6 +184,45 @@ Set rsStatus = Nothing
|
||||
<td><%Response.Write(rs("serialnumber"))%></td>
|
||||
<td><%Response.Write(rs("modelnumber"))%></td>
|
||||
<td><%Response.Write(rs("operatingsystem"))%></td>
|
||||
<td><%
|
||||
' Equipment relationship column
|
||||
If Not IsNull(rs("equipment_id")) And rs("equipment_id") <> "" Then
|
||||
Response.Write("<a href=""./displaymachine.asp?machineid=" & rs("equipment_id") & """ title=""View Equipment"">" & Server.HTMLEncode(rs("equipment_number") & "") & "</a>")
|
||||
Else
|
||||
Response.Write("<span class='text-muted'>-</span>")
|
||||
End If
|
||||
%></td>
|
||||
<td><%
|
||||
' VNC column with link
|
||||
hasVnc = False
|
||||
If Not IsNull(rs("isvnc")) Then
|
||||
If rs("isvnc") = True Or rs("isvnc") = 1 Or rs("isvnc") = -1 Then
|
||||
hasVnc = True
|
||||
End If
|
||||
End If
|
||||
If hasVnc And Not IsNull(rs("hostname")) And rs("hostname") <> "" Then
|
||||
vncHost = rs("hostname") & ".logon.ds.ge.com"
|
||||
Response.Write("<a href=""vnc://" & Server.HTMLEncode(vncHost) & """ title=""Connect via VNC""><span class='badge badge-success'>VNC</span></a>")
|
||||
ElseIf hasVnc Then
|
||||
Response.Write("<span class='badge badge-warning' title='VNC enabled but no hostname'>VNC</span>")
|
||||
Else
|
||||
Response.Write("<span class='text-muted'>-</span>")
|
||||
End If
|
||||
%></td>
|
||||
<td><%
|
||||
' WinRM column
|
||||
hasWinrm = False
|
||||
If Not IsNull(rs("iswinrm")) Then
|
||||
If rs("iswinrm") = True Or rs("iswinrm") = 1 Or rs("iswinrm") = -1 Then
|
||||
hasWinrm = True
|
||||
End If
|
||||
End If
|
||||
If hasWinrm Then
|
||||
Response.Write("<span class='badge badge-success' title='WinRM enabled'>WinRM</span>")
|
||||
Else
|
||||
Response.Write("<span class='text-muted'>-</span>")
|
||||
End If
|
||||
%></td>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
|
||||
Reference in New Issue
Block a user