Standardize ASP filenames: remove underscores
Renamed 45 ASP files to follow lowercase concatenated naming convention: - Direct handlers: save_machine_direct.asp -> savemachinedirect.asp - USB files: checkin_usb.asp -> checkinusb.asp - API files: api_usb.asp -> apiusb.asp - Map files: network_map.asp -> networkmap.asp - Printer files: printer_lookup.asp -> printerlookup.asp Also: - Updated 84+ internal references across all ASP and JS files - Deleted 6 test/duplicate files (editmacine.asp, test_*.asp) - Updated production migration guide with filename changes - Added rename scripts for Linux (bash) and Windows (PowerShell)
This commit is contained in:
160
printerlinksgenerator.asp
Normal file
160
printerlinksgenerator.asp
Normal file
@@ -0,0 +1,160 @@
|
||||
<!--#include file="./includes/sql.asp"-->
|
||||
<%
|
||||
' printerlinksgenerator.asp
|
||||
' Generates installation links for all printers in the database
|
||||
' Shows both single-click launcher links and direct installer command-line parameters
|
||||
|
||||
Response.Write("<!DOCTYPE html>")
|
||||
Response.Write("<html lang='en'>")
|
||||
Response.Write("<head>")
|
||||
Response.Write(" <meta charset='UTF-8'>")
|
||||
Response.Write(" <meta name='viewport' content='width=device-width, initial-scale=1.0'>")
|
||||
Response.Write(" <title>Printer Installation Link Generator</title>")
|
||||
Response.Write(" <style>")
|
||||
Response.Write(" body { font-family: Arial, sans-serif; max-width: 1400px; margin: 20px auto; padding: 20px; background: #f5f5f5; }")
|
||||
Response.Write(" h1 { color: #003057; border-bottom: 3px solid #0066cc; padding-bottom: 10px; }")
|
||||
Response.Write(" .printer-table { width: 100%; background: white; border-collapse: collapse; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }")
|
||||
Response.Write(" .printer-table th { background: #0066cc; color: white; padding: 12px; text-align: left; font-weight: bold; }")
|
||||
Response.Write(" .printer-table td { padding: 10px; border-bottom: 1px solid #ddd; }")
|
||||
Response.Write(" .printer-table tr:hover { background: #f8f8f8; }")
|
||||
Response.Write(" .csf-badge { background: #0066cc; color: white; padding: 3px 8px; border-radius: 3px; font-size: 11px; font-weight: bold; }")
|
||||
Response.Write(" .copy-btn { background: #0066cc; color: white; border: none; padding: 5px 10px; border-radius: 3px; cursor: pointer; font-size: 12px; }")
|
||||
Response.Write(" .copy-btn:hover { background: #0052a3; }")
|
||||
Response.Write(" .link-input { width: 100%; padding: 5px; font-family: 'Courier New', monospace; font-size: 11px; border: 1px solid #ddd; }")
|
||||
Response.Write(" .filter-box { background: white; padding: 15px; margin-bottom: 20px; border-radius: 5px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }")
|
||||
Response.Write(" .filter-box input { padding: 8px; width: 300px; border: 1px solid #ddd; border-radius: 3px; }")
|
||||
Response.Write(" .info-box { background: #fff3cd; border-left: 4px solid #ffc107; padding: 15px; margin-bottom: 20px; }")
|
||||
Response.Write(" </style>")
|
||||
Response.Write("</head>")
|
||||
Response.Write("<body>")
|
||||
Response.Write(" <h1>Printer Installation Link Generator</h1>")
|
||||
|
||||
Response.Write(" <div class='info-box'>")
|
||||
Response.Write(" <strong>How to use:</strong>")
|
||||
Response.Write(" <ul style='margin: 10px 0;'>")
|
||||
Response.Write(" <li><strong>Web Link:</strong> Use for website buttons - downloads a .bat file that installs the printer</li>")
|
||||
Response.Write(" <li><strong>Command Line:</strong> For documentation or manual installation instructions</li>")
|
||||
Response.Write(" <li><strong>QR Code:</strong> Copy the web link and generate a QR code to print and place on the physical printer</li>")
|
||||
Response.Write(" </ul>")
|
||||
Response.Write(" </div>")
|
||||
|
||||
Response.Write(" <div class='filter-box'>")
|
||||
Response.Write(" <label><strong>Filter printers:</strong></label> ")
|
||||
Response.Write(" <input type='text' id='filterInput' onkeyup='filterTable()' placeholder='Search by name, CSF, location, vendor...' />")
|
||||
Response.Write(" </div>")
|
||||
|
||||
Response.Write(" <table class='printer-table' id='printerTable'>")
|
||||
Response.Write(" <thead>")
|
||||
Response.Write(" <tr>")
|
||||
Response.Write(" <th>Printer Name</th>")
|
||||
Response.Write(" <th>Location</th>")
|
||||
Response.Write(" <th>Model</th>")
|
||||
Response.Write(" <th>Web Link (for buttons)</th>")
|
||||
Response.Write(" <th>Command Line</th>")
|
||||
Response.Write(" </tr>")
|
||||
Response.Write(" </thead>")
|
||||
Response.Write(" <tbody>")
|
||||
|
||||
' Query all active HP and Xerox printers
|
||||
Dim strSQL, rs
|
||||
strSQL = "SELECT p.printerid, p.printerwindowsname, p.printercsfname, p.fqdn, p.ipaddress, " & _
|
||||
"v.vendor, m.modelnumber, p.isactive, ma.alias, ma.machinenumber " & _
|
||||
"FROM printers p " & _
|
||||
"LEFT JOIN models m ON p.modelid = m.modelnumberid " & _
|
||||
"LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _
|
||||
"LEFT JOIN machines ma ON p.machineid = ma.machineid " & _
|
||||
"WHERE p.isactive = 1 " & _
|
||||
"AND (v.vendor = 'HP' OR v.vendor = 'Xerox') " & _
|
||||
"AND ((p.fqdn IS NOT NULL AND p.fqdn != '') OR (p.ipaddress IS NOT NULL AND p.ipaddress != '' AND p.ipaddress != 'USB')) " & _
|
||||
"ORDER BY " & _
|
||||
"CASE WHEN p.printercsfname IS NOT NULL AND p.printercsfname != '' AND p.printercsfname != 'NONE' THEN 0 ELSE 1 END, " & _
|
||||
"p.printercsfname, COALESCE(ma.alias, ma.machinenumber), v.vendor, m.modelnumber"
|
||||
|
||||
Set rs = objConn.Execute(strSQL)
|
||||
|
||||
Dim printerName, csfName, vendor, model, machineAlias, machineNumber, machineName
|
||||
Dim webLink, cmdLine
|
||||
|
||||
Do While Not rs.EOF
|
||||
printerName = rs("printerwindowsname") & ""
|
||||
csfName = rs("printercsfname") & ""
|
||||
vendor = rs("vendor") & ""
|
||||
model = rs("modelnumber") & ""
|
||||
machineAlias = rs("alias") & ""
|
||||
machineNumber = rs("machinenumber") & ""
|
||||
|
||||
' Get machine name
|
||||
If machineAlias <> "" Then
|
||||
machineName = machineAlias
|
||||
Else
|
||||
machineName = machineNumber
|
||||
End If
|
||||
|
||||
' Generate URLs
|
||||
webLink = "https://tsgwp00525.rd.ds.ge.com/shopdb/installprinter.asp?printer=" & Server.URLEncode(printerName)
|
||||
cmdLine = "PrinterInstaller.exe /PRINTER=" & printerName
|
||||
|
||||
' Output table row
|
||||
Response.Write(" <tr>")
|
||||
Response.Write(" <td>")
|
||||
If csfName <> "" And csfName <> "NONE" Then
|
||||
Response.Write(" <span class='csf-badge'>" & Server.HTMLEncode(csfName) & "</span> ")
|
||||
End If
|
||||
Response.Write(Server.HTMLEncode(printerName))
|
||||
Response.Write(" </td>")
|
||||
Response.Write(" <td>" & Server.HTMLEncode(machineName) & "</td>")
|
||||
Response.Write(" <td>" & Server.HTMLEncode(vendor) & " " & Server.HTMLEncode(model) & "</td>")
|
||||
Response.Write(" <td>")
|
||||
Response.Write(" <input type='text' class='link-input' value='" & Server.HTMLEncode(webLink) & "' readonly onclick='this.select()' />")
|
||||
Response.Write(" <button class='copy-btn' onclick='copyToClipboard(""" & Replace(webLink, """", """) & """)'>Copy</button>")
|
||||
Response.Write(" </td>")
|
||||
Response.Write(" <td>")
|
||||
Response.Write(" <input type='text' class='link-input' value='" & Server.HTMLEncode(cmdLine) & "' readonly onclick='this.select()' />")
|
||||
Response.Write(" <button class='copy-btn' onclick='copyToClipboard(""" & Replace(cmdLine, """", """) & """)'>Copy</button>")
|
||||
Response.Write(" </td>")
|
||||
Response.Write(" </tr>")
|
||||
|
||||
rs.MoveNext
|
||||
Loop
|
||||
|
||||
rs.Close
|
||||
Set rs = Nothing
|
||||
objConn.Close
|
||||
|
||||
Response.Write(" </tbody>")
|
||||
Response.Write(" </table>")
|
||||
|
||||
Response.Write(" <script>")
|
||||
Response.Write(" function copyToClipboard(text) {")
|
||||
Response.Write(" navigator.clipboard.writeText(text).then(function() {")
|
||||
Response.Write(" alert('Copied to clipboard!');")
|
||||
Response.Write(" }, function(err) {")
|
||||
Response.Write(" console.error('Could not copy text: ', err);")
|
||||
Response.Write(" });")
|
||||
Response.Write(" }")
|
||||
Response.Write(" ")
|
||||
Response.Write(" function filterTable() {")
|
||||
Response.Write(" var input = document.getElementById('filterInput');")
|
||||
Response.Write(" var filter = input.value.toUpperCase();")
|
||||
Response.Write(" var table = document.getElementById('printerTable');")
|
||||
Response.Write(" var tr = table.getElementsByTagName('tr');")
|
||||
Response.Write(" ")
|
||||
Response.Write(" for (var i = 1; i < tr.length; i++) {")
|
||||
Response.Write(" var td = tr[i].getElementsByTagName('td');")
|
||||
Response.Write(" var found = false;")
|
||||
Response.Write(" for (var j = 0; j < td.length; j++) {")
|
||||
Response.Write(" if (td[j]) {")
|
||||
Response.Write(" var txtValue = td[j].textContent || td[j].innerText;")
|
||||
Response.Write(" if (txtValue.toUpperCase().indexOf(filter) > -1) {")
|
||||
Response.Write(" found = true;")
|
||||
Response.Write(" break;")
|
||||
Response.Write(" }")
|
||||
Response.Write(" }")
|
||||
Response.Write(" }")
|
||||
Response.Write(" tr[i].style.display = found ? '' : 'none';")
|
||||
Response.Write(" }")
|
||||
Response.Write(" }")
|
||||
Response.Write(" </script>")
|
||||
Response.Write("</body>")
|
||||
Response.Write("</html>")
|
||||
%>
|
||||
Reference in New Issue
Block a user