apiprinters.asp: expose mapleft + maptop for installer map UI

Adds p.mapleft, p.maptop to the SELECT and emits them as JSON values
(literal null when the columns are NULL). Consumed by the new
PrinterInstallerMap inno installer (feature/printer-map branch in
inno-installers) which renders the same Leaflet-style site map inside
a custom Inno wizard page rather than a browser, dodging the Edge
policy that blocks .bat downloads and unsigned .exe runs.

Additive change: existing consumers (PrinterInstaller.iss, tests,
installprinter.asp) read JSON by key name and ignore unknown fields.
SELECT change is additive too; no rs(0) numeric indexing in the
codebase. Schema-side: printers.mapleft, maptop already exist (they
are read by printerinstallermap.asp).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-04-30 07:53:48 -04:00
parent c1f4412a52
commit fd295ef35e

View File

@@ -15,7 +15,8 @@ Response.AddHeader "Expires", "0"
Dim strSQL, rs, jsonOutput, isFirst Dim strSQL, rs, jsonOutput, isFirst
strSQL = "SELECT p.printerid, p.printerwindowsname, p.printercsfname, p.fqdn, p.ipaddress, " & _ strSQL = "SELECT p.printerid, p.printerwindowsname, p.printercsfname, p.fqdn, p.ipaddress, " & _
"v.vendor, m.modelnumber, p.isactive, ma.alias, ma.machinenumber, p.installpath " & _ "v.vendor, m.modelnumber, p.isactive, ma.alias, ma.machinenumber, p.installpath, " & _
"p.mapleft, p.maptop " & _
"FROM printers p " & _ "FROM printers p " & _
"LEFT JOIN models m ON p.modelid = m.modelnumberid " & _ "LEFT JOIN models m ON p.modelid = m.modelnumberid " & _
"LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _ "LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _
@@ -159,6 +160,25 @@ Do While Not rs.EOF
jsonOutput = jsonOutput & vbCrLf & " ""modelnumber"": """ & model & """," jsonOutput = jsonOutput & vbCrLf & " ""modelnumber"": """ & model & ""","
jsonOutput = jsonOutput & vbCrLf & " ""machinename"": """ & machineName & """," jsonOutput = jsonOutput & vbCrLf & " ""machinename"": """ & machineName & ""","
jsonOutput = jsonOutput & vbCrLf & " ""installpath"": """ & installPath & """," jsonOutput = jsonOutput & vbCrLf & " ""installpath"": """ & installPath & ""","
' mapleft / maptop are nullable INTs (pixel coords on the site map
' for printerinstallermap.asp + PrinterInstallerMap.exe). Emit JSON
' literal null when the column is NULL so consumers can detect "no
' map coords for this printer" without resorting to magic numbers.
Dim mapLeftVal, mapTopVal
If IsNull(rs("mapleft")) Then
mapLeftVal = "null"
Else
mapLeftVal = CStr(rs("mapleft"))
End If
If IsNull(rs("maptop")) Then
mapTopVal = "null"
Else
mapTopVal = CStr(rs("maptop"))
End If
jsonOutput = jsonOutput & vbCrLf & " ""mapleft"": " & mapLeftVal & ","
jsonOutput = jsonOutput & vbCrLf & " ""maptop"": " & mapTopVal & ","
jsonOutput = jsonOutput & vbCrLf & " ""isactive"": " & LCase(CStr(CBool(rs("isactive")))) jsonOutput = jsonOutput & vbCrLf & " ""isactive"": " & LCase(CStr(CBool(rs("isactive"))))
jsonOutput = jsonOutput & vbCrLf & " }" jsonOutput = jsonOutput & vbCrLf & " }"
End If End If