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:
166
adminclearcache.asp
Normal file
166
adminclearcache.asp
Normal file
@@ -0,0 +1,166 @@
|
||||
<%
|
||||
' Admin utility to clear all cache (Zabbix, Dropdowns, Lists)
|
||||
' Usage: adminclearcache.asp?confirm=yes&type=all|zabbix|dropdown|list
|
||||
%>
|
||||
<!--#include file="./includes/header.asp"-->
|
||||
<!--#include file="./includes/sql.asp"-->
|
||||
<!--#include file="./includes/data_cache.asp"-->
|
||||
<!--#include file="./includes/zabbix_cached.asp"-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Clear Cache - Admin</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; padding: 20px; }
|
||||
.container { max-width: 800px; margin: 0 auto; background: var(--card-bg, white); color: var(--text-color, #333); padding: 30px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
|
||||
h2 { color: var(--text-color, #333); margin-top: 0; }
|
||||
.success { background: #d4edda; border: 1px solid #c3e6cb; color: #155724; padding: 15px; border-radius: 4px; margin: 20px 0; }
|
||||
.warning { background: #fff3cd; border: 1px solid #ffeaa7; color: #856404; padding: 15px; border-radius: 4px; margin: 20px 0; }
|
||||
.info { background: #d1ecf1; border: 1px solid #bee5eb; color: #0c5460; padding: 15px; border-radius: 4px; margin: 20px 0; }
|
||||
.btn { display: inline-block; padding: 10px 20px; background: #007bff; color: white; text-decoration: none; border-radius: 4px; border: none; cursor: pointer; margin: 2px; }
|
||||
.btn:hover { background: #0056b3; }
|
||||
.btn-danger { background: #dc3545; }
|
||||
.btn-danger:hover { background: #c82333; }
|
||||
.btn-sm { font-size: 12px; padding: 4px 12px; }
|
||||
.back-link { display: inline-block; margin-top: 20px; color: #007bff; text-decoration: none; }
|
||||
table { margin: 20px 0; border-collapse: collapse; width: 100%; }
|
||||
th { padding: 10px; text-align: left; background: var(--table-header-bg, #f5f5f5); border-bottom: 2px solid var(--border-color, #ddd); color: var(--text-color, #333); }
|
||||
td { padding: 10px; border-bottom: 1px solid var(--border-color, #ddd); color: var(--text-color, #333); }
|
||||
tr:hover { background: var(--row-hover-bg, rgba(0,0,0,0.02)); }
|
||||
.form-group { margin: 15px 0; }
|
||||
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; color: var(--text-color, #333); }
|
||||
.form-group input { padding: 8px; width: 100%; max-width: 400px; border: 1px solid var(--border-color, #ddd); border-radius: 4px; background: var(--input-bg, white); color: var(--text-color, #333); }
|
||||
|
||||
/* Dark mode support */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body { background: #1a1a1a; }
|
||||
.container { background: #2d2d2d; color: #e0e0e0; }
|
||||
h2 { color: #e0e0e0; }
|
||||
th { background: #3a3a3a; color: #e0e0e0; }
|
||||
td { color: #e0e0e0; }
|
||||
tr:hover { background: rgba(255,255,255,0.05); }
|
||||
.form-group input { background: #3a3a3a; color: #e0e0e0; border-color: #555; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h2>🔧 Cache Management</h2>
|
||||
|
||||
<%
|
||||
Dim confirm, cacheType, redirectPage, printerIP
|
||||
confirm = Request.QueryString("confirm")
|
||||
cacheType = Request.QueryString("type")
|
||||
redirectPage = Request.QueryString("redirect")
|
||||
printerIP = Trim(Request.QueryString("printerip") & "")
|
||||
|
||||
If cacheType = "" Then cacheType = "all"
|
||||
|
||||
If confirm = "yes" Then
|
||||
' Clear selected cache
|
||||
Select Case cacheType
|
||||
Case "printer"
|
||||
If printerIP <> "" Then
|
||||
Call ClearPrinterCache(printerIP)
|
||||
Response.Write("<div class='success'><strong>✓ Success!</strong> Cache cleared for printer: " & Server.HTMLEncode(printerIP) & "</div>")
|
||||
Else
|
||||
Response.Write("<div class='warning'><strong>⚠️ Error:</strong> No printer IP specified.</div>")
|
||||
End If
|
||||
Case "zabbix"
|
||||
Call ClearAllZabbixCache()
|
||||
Response.Write("<div class='success'><strong>✓ Success!</strong> All Zabbix cache cleared (all printers).</div>")
|
||||
Case "dropdown"
|
||||
Call ClearDropdownCache()
|
||||
Response.Write("<div class='success'><strong>✓ Success!</strong> Dropdown cache cleared.</div>")
|
||||
Case "list"
|
||||
Call ClearListCache()
|
||||
Response.Write("<div class='success'><strong>✓ Success!</strong> List cache cleared.</div>")
|
||||
Case Else
|
||||
Call ClearAllZabbixCache()
|
||||
Call ClearAllDataCache()
|
||||
Response.Write("<div class='success'><strong>✓ Success!</strong> All cache cleared.</div>")
|
||||
End Select
|
||||
|
||||
' Redirect if specified, otherwise show link
|
||||
If redirectPage <> "" Then
|
||||
Response.Write("<meta http-equiv='refresh' content='1; url=./" & redirectPage & "'>")
|
||||
Response.Write("<p>Redirecting back to report...</p>")
|
||||
Else
|
||||
Response.Write("<br><a href='./displayprinters.asp' class='btn'>View Printers</a>")
|
||||
End If
|
||||
Else
|
||||
' Show cache statistics
|
||||
Dim key, zabbixCount, dropdownCount, listCount
|
||||
zabbixCount = 0
|
||||
dropdownCount = 0
|
||||
listCount = 0
|
||||
|
||||
For Each key In Application.Contents
|
||||
If Right(key, 5) <> "_time" And Right(key, 11) <> "_refreshing" Then
|
||||
If Left(key, 7) = "zabbix_" Then zabbixCount = zabbixCount + 1
|
||||
If Left(key, 9) = "dropdown_" Then dropdownCount = dropdownCount + 1
|
||||
If Left(key, 5) = "list_" Then listCount = listCount + 1
|
||||
End If
|
||||
Next
|
||||
|
||||
Response.Write("<p><strong>Current cache status:</strong></p>")
|
||||
Response.Write("<table>")
|
||||
Response.Write("<tr>")
|
||||
Response.Write("<th>Cache Type</th>")
|
||||
Response.Write("<th>Items</th>")
|
||||
Response.Write("<th>Description</th>")
|
||||
Response.Write("<th>Action</th>")
|
||||
Response.Write("</tr>")
|
||||
|
||||
Response.Write("<tr>")
|
||||
Response.Write("<td>Zabbix Data (All Printers)</td>")
|
||||
Response.Write("<td><strong>" & zabbixCount & "</strong></td>")
|
||||
Response.Write("<td>Toner levels, printer status for all printers</td>")
|
||||
Response.Write("<td><a href='?confirm=yes&type=zabbix' class='btn btn-sm'>Clear All</a></td>")
|
||||
Response.Write("</tr>")
|
||||
|
||||
Response.Write("<tr>")
|
||||
Response.Write("<td>Dropdowns</td>")
|
||||
Response.Write("<td><strong>" & dropdownCount & "</strong></td>")
|
||||
Response.Write("<td>Vendors, models (cached 1 hour)</td>")
|
||||
Response.Write("<td><a href='?confirm=yes&type=dropdown' class='btn btn-sm'>Clear</a></td>")
|
||||
Response.Write("</tr>")
|
||||
|
||||
Response.Write("<tr>")
|
||||
Response.Write("<td>Lists</td>")
|
||||
Response.Write("<td><strong>" & listCount & "</strong></td>")
|
||||
Response.Write("<td>Printer lists (cached 5 min)</td>")
|
||||
Response.Write("<td><a href='?confirm=yes&type=list' class='btn btn-sm'>Clear</a></td>")
|
||||
Response.Write("</tr>")
|
||||
|
||||
Response.Write("</table>")
|
||||
|
||||
' Add form for individual printer cache clearing
|
||||
Response.Write("<div class='info' style='margin-top:30px;'>")
|
||||
Response.Write("<strong>🖨️ Clear Individual Printer Cache</strong>")
|
||||
Response.Write("<p>To clear cache for a specific printer, enter its IP address:</p>")
|
||||
Response.Write("<form method='get' action='adminclearcache.asp'>")
|
||||
Response.Write("<input type='hidden' name='confirm' value='yes'>")
|
||||
Response.Write("<input type='hidden' name='type' value='printer'>")
|
||||
Response.Write("<div class='form-group'>")
|
||||
Response.Write("<label for='printerip'>Printer IP Address:</label>")
|
||||
Response.Write("<input type='text' id='printerip' name='printerip' placeholder='e.g., 192.168.1.100' required pattern='^(\d{1,3}\.){3}\d{1,3}$'>")
|
||||
Response.Write("</div>")
|
||||
Response.Write("<button type='submit' class='btn'>Clear Printer Cache</button>")
|
||||
Response.Write("</form>")
|
||||
Response.Write("</div>")
|
||||
|
||||
Response.Write("<div class='warning'>")
|
||||
Response.Write("<strong>⚠️ Note:</strong> Clearing cache will cause slower page loads until cache rebuilds.")
|
||||
Response.Write("</div>")
|
||||
Response.Write("<br>")
|
||||
Response.Write("<a href='?confirm=yes&type=all' class='btn btn-danger'>Clear ALL Cache</a> ")
|
||||
Response.Write("<a href='./default.asp' class='btn'>Cancel</a>")
|
||||
End If
|
||||
%>
|
||||
|
||||
<br><br>
|
||||
<a href="./default.asp" class="back-link">← Back to Home</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user