Remove legacy pc tables, fix ASP issues, update dashboard APIs
Database changes (run sql/migration_drop_pc_tables.sql on prod): - Drop pc, pc_backup_phase2, pc_to_machine_id_mapping tables - Rename pcid columns to machineid in machineoverrides, dualpathassignments, networkinterfaces - Recreate 9 views to use machines.machineid instead of pcid - Clean orphaned records and add FK constraints to machines table ASP fixes: - editprinter.asp: Fix CLng type mismatch when no printerid provided - includes/sql.asp: Remove AutoDeactivateExpiredNotifications (endtime handles expiry) - includes/leftsidebar.asp: Update fiscal week banner styling, remove dead Information link - charts/warrantychart.asp: Use vw_warranty_status instead of pc table Dashboard API renames (naming convention): - shopfloor-dashboard: Update to use apishopfloor.asp, apibusinessunits.asp - tv-dashboard: Rename api_slides.asp to apislides.asp 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
78
tv-dashboard/apislides.asp
Normal file
78
tv-dashboard/apislides.asp
Normal file
@@ -0,0 +1,78 @@
|
||||
<%@ Language="VBScript" %>
|
||||
<%
|
||||
Response.ContentType = "application/json"
|
||||
Response.Buffer = True
|
||||
|
||||
' Slides folder path (local to IIS)
|
||||
Dim SLIDES_FOLDER
|
||||
SLIDES_FOLDER = Server.MapPath("slides")
|
||||
|
||||
' Valid image extensions
|
||||
Dim validExtensions
|
||||
validExtensions = Array("jpg", "jpeg", "png", "gif", "bmp", "webp")
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
Dim fso, folder, file, slides, ext, i
|
||||
Set fso = Server.CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
' Check if folder exists
|
||||
If Not fso.FolderExists(SLIDES_FOLDER) Then
|
||||
Response.Write("{""success"":false,""message"":""Slides folder not found""}")
|
||||
Set fso = Nothing
|
||||
Response.End
|
||||
End If
|
||||
|
||||
Set folder = fso.GetFolder(SLIDES_FOLDER)
|
||||
|
||||
' Build array of image files
|
||||
Dim fileList()
|
||||
Dim fileCount
|
||||
fileCount = 0
|
||||
|
||||
For Each file In folder.Files
|
||||
ext = LCase(fso.GetExtensionName(file.Name))
|
||||
|
||||
' Check if valid image extension
|
||||
For i = 0 To UBound(validExtensions)
|
||||
If ext = validExtensions(i) Then
|
||||
ReDim Preserve fileList(fileCount)
|
||||
fileList(fileCount) = file.Name
|
||||
fileCount = fileCount + 1
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
' Sort files alphabetically (simple bubble sort)
|
||||
Dim j, temp
|
||||
If fileCount > 1 Then
|
||||
For i = 0 To fileCount - 2
|
||||
For j = i + 1 To fileCount - 1
|
||||
If fileList(i) > fileList(j) Then
|
||||
temp = fileList(i)
|
||||
fileList(i) = fileList(j)
|
||||
fileList(j) = temp
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
End If
|
||||
|
||||
' Build JSON response
|
||||
Dim json
|
||||
json = "{""success"":true,""basepath"":""slides/"",""slides"":["
|
||||
|
||||
If fileCount > 0 Then
|
||||
For i = 0 To fileCount - 1
|
||||
If i > 0 Then json = json & ","
|
||||
json = json & "{""filename"":""" & fileList(i) & """}"
|
||||
Next
|
||||
End If
|
||||
|
||||
json = json & "]}"
|
||||
|
||||
Response.Write(json)
|
||||
|
||||
Set folder = Nothing
|
||||
Set fso = Nothing
|
||||
%>
|
||||
Reference in New Issue
Block a user