From fd295ef35e3b683dc88ae00e33d83054b19dc218 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Thu, 30 Apr 2026 07:53:48 -0400 Subject: [PATCH] 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) --- apiprinters.asp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/apiprinters.asp b/apiprinters.asp index cbc27f1..3f0548b 100644 --- a/apiprinters.asp +++ b/apiprinters.asp @@ -15,7 +15,8 @@ Response.AddHeader "Expires", "0" Dim strSQL, rs, jsonOutput, isFirst 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 " & _ "LEFT JOIN models m ON p.modelid = m.modelnumberid " & _ "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 & " ""machinename"": """ & machineName & """," 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 & " }" End If