Add FQDN support for network devices and fix printer installer map
## Printer Installer Map Fixes - Fixed printer_installer_map.asp to pass printer IDs instead of generated names - Fixed install_printer.asp dictionary key collision by using printerid ## Network Device FQDN Support - Added fqdn column to machines table (migration script included) - Updated device edit pages: deviceaccesspoint.asp, deviceserver.asp, deviceswitch.asp, devicecamera.asp - Updated save_network_device.asp to handle FQDN in INSERT/UPDATE - Updated network_devices.asp to display FQDN for Server, Switch, Camera - Updated vw_network_devices view to include FQDN from machines table - Added FQDN field to machine_edit.asp Network tab - Updated savemachineedit.asp to save FQDN ## Printer Install Path Edit - Added installpath field to displayprinter.asp Edit tab - Updated editprinter.asp to save installpath changes ## Documentation - Added IIS log location to CLAUDE.md ## Production Migration - sql/add_fqdn_to_machines.sql - Run on production to add column and update view 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
165
CLAUDE.md
Normal file
165
CLAUDE.md
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
# ShopDB - Claude Code Instructions
|
||||||
|
|
||||||
|
## Project Overview
|
||||||
|
|
||||||
|
ShopDB is a Classic ASP/VBScript web application for managing manufacturing shop floor infrastructure at GE Aerospace. It tracks machines, PCs, printers, and network devices.
|
||||||
|
|
||||||
|
## Technology Stack
|
||||||
|
|
||||||
|
- **Backend:** Classic ASP (VBScript)
|
||||||
|
- **Database:** MySQL 5.6
|
||||||
|
- **Frontend:** Bootstrap 4.6, jQuery, DataTables
|
||||||
|
- **Server:** IIS on Windows VM (192.168.122.151:8080)
|
||||||
|
- **Version Control:** Gitea (localhost:3000)
|
||||||
|
|
||||||
|
## Key Architecture
|
||||||
|
|
||||||
|
### Database Schema (Phase 2 - Current)
|
||||||
|
|
||||||
|
```
|
||||||
|
machines table (unified)
|
||||||
|
├── Equipment (machinetypeid 1-24, pctypeid IS NULL)
|
||||||
|
├── PCs (machinetypeid 33-35, pctypeid IS NOT NULL)
|
||||||
|
└── Network Devices (machinetypeid 16-20)
|
||||||
|
|
||||||
|
printers table (separate)
|
||||||
|
communications table (all network interfaces)
|
||||||
|
machinerelationships table (PC↔equipment links)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Key Queries
|
||||||
|
|
||||||
|
```sql
|
||||||
|
-- All PCs
|
||||||
|
SELECT * FROM machines WHERE pctypeid IS NOT NULL;
|
||||||
|
|
||||||
|
-- All Equipment
|
||||||
|
SELECT * FROM machines WHERE pctypeid IS NULL AND machinetypeid < 16;
|
||||||
|
|
||||||
|
-- Network devices
|
||||||
|
SELECT * FROM machines WHERE machinetypeid IN (16,17,18,19,20);
|
||||||
|
```
|
||||||
|
|
||||||
|
## File Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
/home/camp/projects/windows/shopdb/
|
||||||
|
├── *.asp # Main ASP pages
|
||||||
|
├── api.asp # REST API for PowerShell
|
||||||
|
├── includes/ # Shared includes (header, footer, sql)
|
||||||
|
├── js/ # JavaScript files
|
||||||
|
├── css/ # Stylesheets
|
||||||
|
├── images/ # Images and icons
|
||||||
|
├── docs/ # Documentation
|
||||||
|
├── sql/ # SQL scripts
|
||||||
|
│ ├── migration_phase1/
|
||||||
|
│ ├── migration_phase2/
|
||||||
|
│ └── migration_phase3/
|
||||||
|
└── logs/ # Application logs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Log Locations
|
||||||
|
|
||||||
|
**IIS Logs (Windows VM):** `/home/camp/projects/windows/logs/shopdb/`
|
||||||
|
- Format: `ex[YYMMDD].log` (e.g., `ex251201.log` for Dec 1, 2025)
|
||||||
|
- These are synced from the Windows VM via Samba share
|
||||||
|
- Contains HTTP request logs with status codes and error messages
|
||||||
|
|
||||||
|
**API Logs:** Check `logs/` folder in shopdb directory on IIS
|
||||||
|
|
||||||
|
## Coding Standards
|
||||||
|
|
||||||
|
### ASP/VBScript
|
||||||
|
|
||||||
|
1. **Always use parameterized queries** - Never concatenate user input into SQL
|
||||||
|
2. **Use HTMLEncode for output** - Prevent XSS attacks
|
||||||
|
3. **Convert text fields to strings** - Use `& ""` to avoid type mismatch errors
|
||||||
|
4. **Use Option Explicit** - Declare all variables
|
||||||
|
|
||||||
|
### Example Safe Query
|
||||||
|
|
||||||
|
```vbscript
|
||||||
|
Dim cmd, rs
|
||||||
|
Set cmd = Server.CreateObject("ADODB.Command")
|
||||||
|
cmd.ActiveConnection = objConn
|
||||||
|
cmd.CommandText = "SELECT * FROM machines WHERE machineid = ?"
|
||||||
|
cmd.Parameters.Append cmd.CreateParameter("@id", 3, 1, , machineId)
|
||||||
|
Set rs = cmd.Execute()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example Safe Output
|
||||||
|
|
||||||
|
```vbscript
|
||||||
|
' Always convert to string and encode
|
||||||
|
Dim hostname
|
||||||
|
hostname = ""
|
||||||
|
If NOT IsNull(rs("hostname")) Then hostname = rs("hostname") & ""
|
||||||
|
Response.Write(Server.HTMLEncode(hostname))
|
||||||
|
```
|
||||||
|
|
||||||
|
## Common Tasks
|
||||||
|
|
||||||
|
### Reading Files
|
||||||
|
- Main pages are in project root (*.asp)
|
||||||
|
- Includes are in /includes/
|
||||||
|
- Check docs/ for documentation
|
||||||
|
|
||||||
|
### Making Changes
|
||||||
|
1. Read the file first
|
||||||
|
2. Use parameterized queries for any SQL
|
||||||
|
3. Test on dev server (192.168.122.151:8080)
|
||||||
|
4. Check IIS logs for errors
|
||||||
|
|
||||||
|
### Database Access
|
||||||
|
```bash
|
||||||
|
docker exec -it dev-mysql mysql -u root -prootpassword shopdb
|
||||||
|
```
|
||||||
|
|
||||||
|
## Important Notes
|
||||||
|
|
||||||
|
### VBScript Limitations
|
||||||
|
- No `IIf()` function - use If-Then-Else instead
|
||||||
|
- No Try-Catch - use On Error Resume Next carefully
|
||||||
|
- Strings are 1-indexed, not 0-indexed
|
||||||
|
|
||||||
|
### Column Name Gotchas
|
||||||
|
- `address` not `ipaddress` in communications table
|
||||||
|
- `machinenotes` not `notes` in machines table
|
||||||
|
- `machineid` not `pcid` for PCs in machines table
|
||||||
|
|
||||||
|
### PC Identification
|
||||||
|
PCs are in the machines table, identified by:
|
||||||
|
- `pctypeid IS NOT NULL`
|
||||||
|
- `machinetypeid IN (33, 34, 35)`
|
||||||
|
|
||||||
|
## API Endpoints
|
||||||
|
|
||||||
|
**Base URL:** `http://192.168.122.151:8080/api.asp`
|
||||||
|
|
||||||
|
| Action | Method | Description |
|
||||||
|
|--------|--------|-------------|
|
||||||
|
| updateCompleteAsset | POST | PC data collection |
|
||||||
|
| getDashboardData | GET | Health check |
|
||||||
|
| updatePrinterMapping | POST | Printer assignments |
|
||||||
|
|
||||||
|
## Quick Reference
|
||||||
|
|
||||||
|
### Start Dev Environment
|
||||||
|
```bash
|
||||||
|
~/start-dev-env.sh
|
||||||
|
~/status-dev-env.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Git Commands
|
||||||
|
```bash
|
||||||
|
cd /home/camp/projects/windows/shopdb
|
||||||
|
git status
|
||||||
|
git add .
|
||||||
|
git commit -m "message"
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
### Test a Page
|
||||||
|
```bash
|
||||||
|
curl -s http://192.168.122.151:8080/pagename.asp | head -50
|
||||||
|
```
|
||||||
@@ -22,18 +22,18 @@
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
' If editing, fetch existing data
|
' If editing, fetch existing data
|
||||||
Dim rs, accesspointname, modelid, serialnumber, ipaddress, description, maptop, mapleft, isactive
|
Dim rs, accesspointname, modelid, serialnumber, ipaddress, fqdn, description, maptop, mapleft, isactive
|
||||||
Dim vendorname, modelnumber
|
Dim vendorname, modelnumber
|
||||||
If Not isNewRecord Then
|
If Not isNewRecord Then
|
||||||
Dim strSQL
|
Dim strSQL
|
||||||
strSQL = "SELECT mac.machineid, mac.alias AS apname, mac.modelnumberid AS modelid, " & _
|
strSQL = "SELECT mac.machineid, mac.alias AS apname, mac.modelnumberid AS modelid, " & _
|
||||||
"mac.serialnumber, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
|
"mac.serialnumber, mac.fqdn, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
|
||||||
"m.modelnumber, v.vendor, c.address AS ipaddress " & _
|
"m.modelnumber, v.vendor, c.address AS ipaddress " & _
|
||||||
"FROM machines mac " & _
|
"FROM machines mac " & _
|
||||||
"LEFT JOIN models m ON mac.modelnumberid = m.modelnumberid " & _
|
"LEFT JOIN models m ON mac.modelnumberid = m.modelnumberid " & _
|
||||||
"LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _
|
"LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _
|
||||||
"LEFT JOIN communications c ON mac.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1 " & _
|
"LEFT JOIN communications c ON mac.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1 " & _
|
||||||
"WHERE mac.machineid = " & accesspointid & " AND mac.machinetypeid = 33"
|
"WHERE mac.machineid = " & accesspointid & " AND mac.machinetypeid = 16"
|
||||||
Set rs = objConn.Execute(strSQL)
|
Set rs = objConn.Execute(strSQL)
|
||||||
|
|
||||||
If rs.EOF Then
|
If rs.EOF Then
|
||||||
@@ -49,6 +49,7 @@
|
|||||||
Else
|
Else
|
||||||
ipaddress = ""
|
ipaddress = ""
|
||||||
End If
|
End If
|
||||||
|
If Not IsNull(rs("fqdn")) Then fqdn = rs("fqdn") Else fqdn = ""
|
||||||
If Not IsNull(rs("description")) Then description = rs("description") Else description = ""
|
If Not IsNull(rs("description")) Then description = rs("description") Else description = ""
|
||||||
If Not IsNull(rs("maptop")) Then maptop = rs("maptop") Else maptop = ""
|
If Not IsNull(rs("maptop")) Then maptop = rs("maptop") Else maptop = ""
|
||||||
If Not IsNull(rs("mapleft")) Then mapleft = rs("mapleft") Else mapleft = ""
|
If Not IsNull(rs("mapleft")) Then mapleft = rs("mapleft") Else mapleft = ""
|
||||||
@@ -64,6 +65,7 @@
|
|||||||
modelid = ""
|
modelid = ""
|
||||||
serialnumber = ""
|
serialnumber = ""
|
||||||
ipaddress = ""
|
ipaddress = ""
|
||||||
|
fqdn = ""
|
||||||
description = ""
|
description = ""
|
||||||
maptop = ""
|
maptop = ""
|
||||||
mapleft = ""
|
mapleft = ""
|
||||||
@@ -270,6 +272,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-sm-3 col-form-label">FQDN</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" name="fqdn" class="form-control"
|
||||||
|
value="<%=Server.HTMLEncode(fqdn)%>"
|
||||||
|
maxlength="255"
|
||||||
|
placeholder="e.g., ap-01.network.company.com">
|
||||||
|
<small class="form-text text-muted">
|
||||||
|
Fully Qualified Domain Name (optional)
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-sm-3 col-form-label">Description</label>
|
<label class="col-sm-3 col-form-label">Description</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
|
|||||||
@@ -22,12 +22,12 @@
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
' If editing, fetch existing data
|
' If editing, fetch existing data
|
||||||
Dim rs, cameraname, modelid, idfid, serialnumber, macaddress, ipaddress, description, maptop, mapleft, isactive
|
Dim rs, cameraname, modelid, idfid, serialnumber, macaddress, ipaddress, fqdn, description, maptop, mapleft, isactive
|
||||||
Dim vendorname, modelnumber, idfname
|
Dim vendorname, modelnumber, idfname
|
||||||
If Not isNewRecord Then
|
If Not isNewRecord Then
|
||||||
Dim strSQL
|
Dim strSQL
|
||||||
strSQL = "SELECT mac.machineid, mac.alias AS cameraname, mac.modelnumberid AS modelid, " & _
|
strSQL = "SELECT mac.machineid, mac.alias AS cameraname, mac.modelnumberid AS modelid, " & _
|
||||||
"mac.serialnumber, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
|
"mac.serialnumber, mac.fqdn, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
|
||||||
"m.modelnumber, v.vendor, c.address AS ipaddress, c.macaddress, " & _
|
"m.modelnumber, v.vendor, c.address AS ipaddress, c.macaddress, " & _
|
||||||
"mr.related_machineid AS idfid, idf.alias AS idfname " & _
|
"mr.related_machineid AS idfid, idf.alias AS idfname " & _
|
||||||
"FROM machines mac " & _
|
"FROM machines mac " & _
|
||||||
@@ -36,8 +36,8 @@
|
|||||||
"LEFT JOIN communications c ON mac.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1 " & _
|
"LEFT JOIN communications c ON mac.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1 " & _
|
||||||
"LEFT JOIN machinerelationships mr ON mac.machineid = mr.machineid AND mr.relationshiptypeid = " & _
|
"LEFT JOIN machinerelationships mr ON mac.machineid = mr.machineid AND mr.relationshiptypeid = " & _
|
||||||
"(SELECT relationshiptypeid FROM relationshiptypes WHERE relationshiptype = 'Connected To' LIMIT 1) " & _
|
"(SELECT relationshiptypeid FROM relationshiptypes WHERE relationshiptype = 'Connected To' LIMIT 1) " & _
|
||||||
"LEFT JOIN machines idf ON mr.related_machineid = idf.machineid AND idf.machinetypeid = 34 " & _
|
"LEFT JOIN machines idf ON mr.related_machineid = idf.machineid AND idf.machinetypeid = 17 " & _
|
||||||
"WHERE mac.machineid = " & cameraid & " AND mac.machinetypeid = 32"
|
"WHERE mac.machineid = " & cameraid & " AND mac.machinetypeid = 18"
|
||||||
Set rs = objConn.Execute(strSQL)
|
Set rs = objConn.Execute(strSQL)
|
||||||
|
|
||||||
If rs.EOF Then
|
If rs.EOF Then
|
||||||
@@ -63,6 +63,7 @@
|
|||||||
Else
|
Else
|
||||||
ipaddress = ""
|
ipaddress = ""
|
||||||
End If
|
End If
|
||||||
|
If Not IsNull(rs("fqdn")) Then fqdn = rs("fqdn") Else fqdn = ""
|
||||||
If Not IsNull(rs("description")) Then description = rs("description") Else description = ""
|
If Not IsNull(rs("description")) Then description = rs("description") Else description = ""
|
||||||
If Not IsNull(rs("maptop")) Then maptop = rs("maptop") Else maptop = ""
|
If Not IsNull(rs("maptop")) Then maptop = rs("maptop") Else maptop = ""
|
||||||
If Not IsNull(rs("mapleft")) Then mapleft = rs("mapleft") Else mapleft = ""
|
If Not IsNull(rs("mapleft")) Then mapleft = rs("mapleft") Else mapleft = ""
|
||||||
@@ -85,6 +86,7 @@
|
|||||||
serialnumber = ""
|
serialnumber = ""
|
||||||
macaddress = ""
|
macaddress = ""
|
||||||
ipaddress = ""
|
ipaddress = ""
|
||||||
|
fqdn = ""
|
||||||
description = ""
|
description = ""
|
||||||
maptop = ""
|
maptop = ""
|
||||||
mapleft = ""
|
mapleft = ""
|
||||||
@@ -376,6 +378,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-sm-3 col-form-label">FQDN</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" name="fqdn" class="form-control"
|
||||||
|
value="<%=Server.HTMLEncode(fqdn)%>"
|
||||||
|
maxlength="255"
|
||||||
|
placeholder="e.g., cam01.security.company.com">
|
||||||
|
<small class="form-text text-muted">
|
||||||
|
Fully Qualified Domain Name (optional)
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-sm-3 col-form-label">Description</label>
|
<label class="col-sm-3 col-form-label">Description</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
|
|||||||
@@ -22,18 +22,18 @@
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
' If editing, fetch existing data
|
' If editing, fetch existing data
|
||||||
Dim rs, servername, modelid, serialnumber, ipaddress, description, maptop, mapleft, isactive
|
Dim rs, servername, modelid, serialnumber, ipaddress, fqdn, description, maptop, mapleft, isactive
|
||||||
Dim vendorname, modelnumber
|
Dim vendorname, modelnumber
|
||||||
If Not isNewRecord Then
|
If Not isNewRecord Then
|
||||||
Dim strSQL
|
Dim strSQL
|
||||||
strSQL = "SELECT mac.machineid, mac.alias AS servername, mac.modelnumberid AS modelid, " & _
|
strSQL = "SELECT mac.machineid, mac.alias AS servername, mac.modelnumberid AS modelid, " & _
|
||||||
"mac.serialnumber, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
|
"mac.serialnumber, mac.fqdn, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
|
||||||
"m.modelnumber, v.vendor, c.address AS ipaddress " & _
|
"m.modelnumber, v.vendor, c.address AS ipaddress " & _
|
||||||
"FROM machines mac " & _
|
"FROM machines mac " & _
|
||||||
"LEFT JOIN models m ON mac.modelnumberid = m.modelnumberid " & _
|
"LEFT JOIN models m ON mac.modelnumberid = m.modelnumberid " & _
|
||||||
"LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _
|
"LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _
|
||||||
"LEFT JOIN communications c ON mac.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1 " & _
|
"LEFT JOIN communications c ON mac.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1 " & _
|
||||||
"WHERE mac.machineid = " & serverid & " AND mac.machinetypeid = 30"
|
"WHERE mac.machineid = " & serverid & " AND mac.machinetypeid = 20"
|
||||||
Set rs = objConn.Execute(strSQL)
|
Set rs = objConn.Execute(strSQL)
|
||||||
|
|
||||||
If rs.EOF Then
|
If rs.EOF Then
|
||||||
@@ -45,6 +45,7 @@
|
|||||||
If Not IsNull(rs("modelid")) Then modelid = rs("modelid") Else modelid = ""
|
If Not IsNull(rs("modelid")) Then modelid = rs("modelid") Else modelid = ""
|
||||||
If Not IsNull(rs("serialnumber")) Then serialnumber = rs("serialnumber") Else serialnumber = ""
|
If Not IsNull(rs("serialnumber")) Then serialnumber = rs("serialnumber") Else serialnumber = ""
|
||||||
If Not IsNull(rs("ipaddress")) Then ipaddress = rs("ipaddress") Else ipaddress = ""
|
If Not IsNull(rs("ipaddress")) Then ipaddress = rs("ipaddress") Else ipaddress = ""
|
||||||
|
If Not IsNull(rs("fqdn")) Then fqdn = rs("fqdn") Else fqdn = ""
|
||||||
If Not IsNull(rs("description")) Then description = rs("description") Else description = ""
|
If Not IsNull(rs("description")) Then description = rs("description") Else description = ""
|
||||||
If Not IsNull(rs("maptop")) Then maptop = rs("maptop") Else maptop = ""
|
If Not IsNull(rs("maptop")) Then maptop = rs("maptop") Else maptop = ""
|
||||||
If Not IsNull(rs("mapleft")) Then mapleft = rs("mapleft") Else mapleft = ""
|
If Not IsNull(rs("mapleft")) Then mapleft = rs("mapleft") Else mapleft = ""
|
||||||
@@ -60,6 +61,7 @@
|
|||||||
modelid = ""
|
modelid = ""
|
||||||
serialnumber = ""
|
serialnumber = ""
|
||||||
ipaddress = ""
|
ipaddress = ""
|
||||||
|
fqdn = ""
|
||||||
description = ""
|
description = ""
|
||||||
maptop = ""
|
maptop = ""
|
||||||
mapleft = ""
|
mapleft = ""
|
||||||
@@ -266,6 +268,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-sm-3 col-form-label">FQDN</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" name="fqdn" class="form-control"
|
||||||
|
value="<%=Server.HTMLEncode(fqdn)%>"
|
||||||
|
maxlength="255"
|
||||||
|
placeholder="e.g., server01.domain.company.com">
|
||||||
|
<small class="form-text text-muted">
|
||||||
|
Fully Qualified Domain Name (optional)
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-sm-3 col-form-label">Description</label>
|
<label class="col-sm-3 col-form-label">Description</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
|
|||||||
@@ -22,18 +22,18 @@
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
' If editing, fetch existing data
|
' If editing, fetch existing data
|
||||||
Dim rs, switchname, modelid, serialnumber, ipaddress, description, maptop, mapleft, isactive
|
Dim rs, switchname, modelid, serialnumber, ipaddress, fqdn, description, maptop, mapleft, isactive
|
||||||
Dim vendorname, modelnumber
|
Dim vendorname, modelnumber
|
||||||
If Not isNewRecord Then
|
If Not isNewRecord Then
|
||||||
Dim strSQL
|
Dim strSQL
|
||||||
strSQL = "SELECT mac.machineid, mac.alias AS switchname, mac.modelnumberid AS modelid, " & _
|
strSQL = "SELECT mac.machineid, mac.alias AS switchname, mac.modelnumberid AS modelid, " & _
|
||||||
"mac.serialnumber, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
|
"mac.serialnumber, mac.fqdn, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
|
||||||
"m.modelnumber, v.vendor, c.address AS ipaddress " & _
|
"m.modelnumber, v.vendor, c.address AS ipaddress " & _
|
||||||
"FROM machines mac " & _
|
"FROM machines mac " & _
|
||||||
"LEFT JOIN models m ON mac.modelnumberid = m.modelnumberid " & _
|
"LEFT JOIN models m ON mac.modelnumberid = m.modelnumberid " & _
|
||||||
"LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _
|
"LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _
|
||||||
"LEFT JOIN communications c ON mac.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1 " & _
|
"LEFT JOIN communications c ON mac.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1 " & _
|
||||||
"WHERE mac.machineid = " & switchid & " AND mac.machinetypeid = 31"
|
"WHERE mac.machineid = " & switchid & " AND mac.machinetypeid = 19"
|
||||||
Set rs = objConn.Execute(strSQL)
|
Set rs = objConn.Execute(strSQL)
|
||||||
|
|
||||||
If rs.EOF Then
|
If rs.EOF Then
|
||||||
@@ -45,6 +45,7 @@
|
|||||||
If Not IsNull(rs("modelid")) Then modelid = rs("modelid") Else modelid = ""
|
If Not IsNull(rs("modelid")) Then modelid = rs("modelid") Else modelid = ""
|
||||||
If Not IsNull(rs("serialnumber")) Then serialnumber = rs("serialnumber") Else serialnumber = ""
|
If Not IsNull(rs("serialnumber")) Then serialnumber = rs("serialnumber") Else serialnumber = ""
|
||||||
If Not IsNull(rs("ipaddress")) Then ipaddress = rs("ipaddress") Else ipaddress = ""
|
If Not IsNull(rs("ipaddress")) Then ipaddress = rs("ipaddress") Else ipaddress = ""
|
||||||
|
If Not IsNull(rs("fqdn")) Then fqdn = rs("fqdn") Else fqdn = ""
|
||||||
If Not IsNull(rs("description")) Then description = rs("description") Else description = ""
|
If Not IsNull(rs("description")) Then description = rs("description") Else description = ""
|
||||||
If Not IsNull(rs("maptop")) Then maptop = rs("maptop") Else maptop = ""
|
If Not IsNull(rs("maptop")) Then maptop = rs("maptop") Else maptop = ""
|
||||||
If Not IsNull(rs("mapleft")) Then mapleft = rs("mapleft") Else mapleft = ""
|
If Not IsNull(rs("mapleft")) Then mapleft = rs("mapleft") Else mapleft = ""
|
||||||
@@ -60,6 +61,7 @@
|
|||||||
modelid = ""
|
modelid = ""
|
||||||
serialnumber = ""
|
serialnumber = ""
|
||||||
ipaddress = ""
|
ipaddress = ""
|
||||||
|
fqdn = ""
|
||||||
description = ""
|
description = ""
|
||||||
maptop = ""
|
maptop = ""
|
||||||
mapleft = ""
|
mapleft = ""
|
||||||
@@ -266,6 +268,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-sm-3 col-form-label">FQDN</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" name="fqdn" class="form-control"
|
||||||
|
value="<%=Server.HTMLEncode(fqdn)%>"
|
||||||
|
maxlength="255"
|
||||||
|
placeholder="e.g., switch01.network.company.com">
|
||||||
|
<small class="form-text text-muted">
|
||||||
|
Fully Qualified Domain Name (optional)
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-sm-3 col-form-label">Description</label>
|
<label class="col-sm-3 col-form-label">Description</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
|
|||||||
@@ -478,11 +478,18 @@ End If
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-lg-3 col-form-label form-control-label">Windows Name::</label>
|
<label class="col-lg-3 col-form-label form-control-label">Windows Name:</label>
|
||||||
<div class="col-lg-9">
|
<div class="col-lg-9">
|
||||||
<input class="form-control" type="text" name="printerwindowsname" value="<%=Server.HTMLEncode(rs("printerwindowsname") & "")%>" placeholder="<%=Server.HTMLEncode(rs("printerwindowsname") & "")%>">
|
<input class="form-control" type="text" name="printerwindowsname" value="<%=Server.HTMLEncode(rs("printerwindowsname") & "")%>" placeholder="<%=Server.HTMLEncode(rs("printerwindowsname") & "")%>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-3 col-form-label form-control-label">Install Path:</label>
|
||||||
|
<div class="col-lg-9">
|
||||||
|
<input class="form-control" type="text" name="installpath" value="<%=Server.HTMLEncode(rs("installpath") & "")%>" placeholder="e.g., drivers/HP/LJ400.exe">
|
||||||
|
<small class="form-text text-muted">Path to specific driver installer (leave blank to use universal driver)</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-lg-3 col-form-label form-control-label">Associated Machine <span class="text-muted">(Optional)</span></label>
|
<label class="col-lg-3 col-form-label form-control-label">Associated Machine <span class="text-muted">(Optional)</span></label>
|
||||||
<div class="col-lg-9">
|
<div class="col-lg-9">
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
END IF
|
END IF
|
||||||
|
|
||||||
' Get and validate all inputs
|
' Get and validate all inputs
|
||||||
Dim printerid, modelid, serialnumber, ipaddress, fqdn, printercsfname, printerwindowsname, machineid, maptop, mapleft
|
Dim printerid, modelid, serialnumber, ipaddress, fqdn, printercsfname, printerwindowsname, installpath, machineid, maptop, mapleft
|
||||||
printerid = Trim(Request.Querystring("printerid"))
|
printerid = Trim(Request.Querystring("printerid"))
|
||||||
modelid = Trim(Request.Form("modelid"))
|
modelid = Trim(Request.Form("modelid"))
|
||||||
serialnumber = Trim(Request.Form("serialnumber"))
|
serialnumber = Trim(Request.Form("serialnumber"))
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
fqdn = Trim(Request.Form("fqdn"))
|
fqdn = Trim(Request.Form("fqdn"))
|
||||||
printercsfname = Trim(Request.Form("printercsfname"))
|
printercsfname = Trim(Request.Form("printercsfname"))
|
||||||
printerwindowsname = Trim(Request.Form("printerwindowsname"))
|
printerwindowsname = Trim(Request.Form("printerwindowsname"))
|
||||||
|
installpath = Trim(Request.Form("installpath"))
|
||||||
machineid = Trim(Request.Form("machineid"))
|
machineid = Trim(Request.Form("machineid"))
|
||||||
maptop = Trim(Request.Form("maptop"))
|
maptop = Trim(Request.Form("maptop"))
|
||||||
mapleft = Trim(Request.Form("mapleft"))
|
mapleft = Trim(Request.Form("mapleft"))
|
||||||
@@ -62,7 +63,7 @@
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
' Validate field lengths
|
' Validate field lengths
|
||||||
If Len(serialnumber) > 100 Or Len(fqdn) > 255 Or Len(printercsfname) > 50 Or Len(printerwindowsname) > 255 Then
|
If Len(serialnumber) > 100 Or Len(fqdn) > 255 Or Len(printercsfname) > 50 Or Len(printerwindowsname) > 255 Or Len(installpath) > 100 Then
|
||||||
objConn.Close
|
objConn.Close
|
||||||
Response.Redirect("displayprinter.asp?printerid=" & printerid & "&error=FIELD_LENGTH_EXCEEDED")
|
Response.Redirect("displayprinter.asp?printerid=" & printerid & "&error=FIELD_LENGTH_EXCEEDED")
|
||||||
Response.End
|
Response.End
|
||||||
@@ -190,7 +191,7 @@
|
|||||||
' Update printer using parameterized query
|
' Update printer using parameterized query
|
||||||
Dim strSQL
|
Dim strSQL
|
||||||
strSQL = "UPDATE printers SET modelid = ?, serialnumber = ?, ipaddress = ?, fqdn = ?, " & _
|
strSQL = "UPDATE printers SET modelid = ?, serialnumber = ?, ipaddress = ?, fqdn = ?, " & _
|
||||||
"printercsfname = ?, printerwindowsname = ?, machineid = ?, maptop = ?, mapleft = ? " & _
|
"printercsfname = ?, printerwindowsname = ?, installpath = ?, machineid = ?, maptop = ?, mapleft = ? " & _
|
||||||
"WHERE printerid = ?"
|
"WHERE printerid = ?"
|
||||||
|
|
||||||
On Error Resume Next
|
On Error Resume Next
|
||||||
@@ -207,6 +208,7 @@
|
|||||||
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@fqdn", 200, 1, 255, fqdn)
|
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@fqdn", 200, 1, 255, fqdn)
|
||||||
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@printercsfname", 200, 1, 50, printercsfname)
|
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@printercsfname", 200, 1, 50, printercsfname)
|
||||||
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@printerwindowsname", 200, 1, 255, printerwindowsname)
|
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@printerwindowsname", 200, 1, 255, printerwindowsname)
|
||||||
|
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@installpath", 200, 1, 100, installpath)
|
||||||
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@machineid", 3, 1, , CLng(machineid))
|
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@machineid", 3, 1, , CLng(machineid))
|
||||||
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@maptop", 3, 1, , maptopValue)
|
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@maptop", 3, 1, , maptopValue)
|
||||||
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@mapleft", 3, 1, , mapleftValue)
|
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@mapleft", 3, 1, , mapleftValue)
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ If printerIds <> "" Or printerNames <> "" Then
|
|||||||
printerInfo("address") = printerInfo("ipaddress")
|
printerInfo("address") = printerInfo("ipaddress")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
printers.Add rs("printerwindowsname"), printerInfo
|
printers.Add CStr(rs("printerid")), printerInfo
|
||||||
rs.MoveNext
|
rs.MoveNext
|
||||||
Wend
|
Wend
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
' Store machine data
|
' Store machine data
|
||||||
Dim machinenumber, modelid, businessunitid, alias, machinenotes, mapleft, maptop
|
Dim machinenumber, modelid, businessunitid, alias, machinenotes, mapleft, maptop, fqdn
|
||||||
machinenumber = "" : If NOT IsNull(rsMachine("machinenumber")) Then machinenumber = rsMachine("machinenumber") & ""
|
machinenumber = "" : If NOT IsNull(rsMachine("machinenumber")) Then machinenumber = rsMachine("machinenumber") & ""
|
||||||
modelid = "" : If NOT IsNull(rsMachine("modelnumberid")) Then modelid = rsMachine("modelnumberid")
|
modelid = "" : If NOT IsNull(rsMachine("modelnumberid")) Then modelid = rsMachine("modelnumberid")
|
||||||
businessunitid = "" : If NOT IsNull(rsMachine("businessunitid")) Then businessunitid = rsMachine("businessunitid")
|
businessunitid = "" : If NOT IsNull(rsMachine("businessunitid")) Then businessunitid = rsMachine("businessunitid")
|
||||||
@@ -62,6 +62,7 @@
|
|||||||
machinenotes = "" : If NOT IsNull(rsMachine("machinenotes")) Then machinenotes = rsMachine("machinenotes") & ""
|
machinenotes = "" : If NOT IsNull(rsMachine("machinenotes")) Then machinenotes = rsMachine("machinenotes") & ""
|
||||||
mapleft = "" : If NOT IsNull(rsMachine("mapleft")) Then mapleft = rsMachine("mapleft")
|
mapleft = "" : If NOT IsNull(rsMachine("mapleft")) Then mapleft = rsMachine("mapleft")
|
||||||
maptop = "" : If NOT IsNull(rsMachine("maptop")) Then maptop = rsMachine("maptop")
|
maptop = "" : If NOT IsNull(rsMachine("maptop")) Then maptop = rsMachine("maptop")
|
||||||
|
fqdn = "" : If NOT IsNull(rsMachine("fqdn")) Then fqdn = rsMachine("fqdn") & ""
|
||||||
|
|
||||||
rsMachine.Close
|
rsMachine.Close
|
||||||
Set rsMachine = Nothing
|
Set rsMachine = Nothing
|
||||||
@@ -461,6 +462,16 @@
|
|||||||
<h5 class="mb-3"><i class="zmdi zmdi-network"></i> Network Communications</h5>
|
<h5 class="mb-3"><i class="zmdi zmdi-network"></i> Network Communications</h5>
|
||||||
<p class="text-muted">Configure network interfaces for this equipment. You can add up to 3 interfaces.</p>
|
<p class="text-muted">Configure network interfaces for this equipment. You can add up to 3 interfaces.</p>
|
||||||
|
|
||||||
|
<!-- FQDN -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="fqdn">FQDN (Fully Qualified Domain Name)</label>
|
||||||
|
<input type="text" class="form-control" id="fqdn" name="fqdn"
|
||||||
|
maxlength="255" placeholder="e.g., device01.network.company.com" value="<%=Server.HTMLEncode(fqdn)%>">
|
||||||
|
<small class="form-text text-muted">Optional - used for network devices like access points, switches, servers</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
<!-- Interface 1 -->
|
<!-- Interface 1 -->
|
||||||
<div class="card mb-3">
|
<div class="card mb-3">
|
||||||
<div class="card-header bg-primary text-white">
|
<div class="card-header bg-primary text-white">
|
||||||
|
|||||||
@@ -103,16 +103,17 @@ If filterType = "IDF" Then
|
|||||||
Response.Write("<th scope='col'>Name</th>")
|
Response.Write("<th scope='col'>Name</th>")
|
||||||
Response.Write("<th scope='col'>Description</th>")
|
Response.Write("<th scope='col'>Description</th>")
|
||||||
ElseIf filterType = "Server" Or filterType = "Switch" Then
|
ElseIf filterType = "Server" Or filterType = "Switch" Then
|
||||||
' Server/Switch columns: Location, Name, Vendor, Model, Serial, IP Address, Description
|
' Server/Switch columns: Location, Name, Vendor, Model, Serial, IP Address, FQDN, Description
|
||||||
Response.Write("<th scope='col'><i class='zmdi zmdi-pin'></i></th>")
|
Response.Write("<th scope='col'><i class='zmdi zmdi-pin'></i></th>")
|
||||||
Response.Write("<th scope='col'>Name</th>")
|
Response.Write("<th scope='col'>Name</th>")
|
||||||
Response.Write("<th scope='col'>Vendor</th>")
|
Response.Write("<th scope='col'>Vendor</th>")
|
||||||
Response.Write("<th scope='col'>Model</th>")
|
Response.Write("<th scope='col'>Model</th>")
|
||||||
Response.Write("<th scope='col'>Serial</th>")
|
Response.Write("<th scope='col'>Serial</th>")
|
||||||
Response.Write("<th scope='col'>IP Address</th>")
|
Response.Write("<th scope='col'>IP Address</th>")
|
||||||
|
Response.Write("<th scope='col'>FQDN</th>")
|
||||||
Response.Write("<th scope='col'>Description</th>")
|
Response.Write("<th scope='col'>Description</th>")
|
||||||
ElseIf filterType = "Camera" Then
|
ElseIf filterType = "Camera" Then
|
||||||
' Camera columns: Location, Name, IDF, Vendor, Model, MAC Address, IP Address
|
' Camera columns: Location, Name, IDF, Vendor, Model, MAC Address, IP Address, FQDN
|
||||||
Response.Write("<th scope='col'><i class='zmdi zmdi-pin'></i></th>")
|
Response.Write("<th scope='col'><i class='zmdi zmdi-pin'></i></th>")
|
||||||
Response.Write("<th scope='col'>Name</th>")
|
Response.Write("<th scope='col'>Name</th>")
|
||||||
Response.Write("<th scope='col'>IDF</th>")
|
Response.Write("<th scope='col'>IDF</th>")
|
||||||
@@ -120,6 +121,7 @@ ElseIf filterType = "Camera" Then
|
|||||||
Response.Write("<th scope='col'>Model</th>")
|
Response.Write("<th scope='col'>Model</th>")
|
||||||
Response.Write("<th scope='col'>MAC Address</th>")
|
Response.Write("<th scope='col'>MAC Address</th>")
|
||||||
Response.Write("<th scope='col'>IP Address</th>")
|
Response.Write("<th scope='col'>IP Address</th>")
|
||||||
|
Response.Write("<th scope='col'>FQDN</th>")
|
||||||
ElseIf filterType = "Access Point" Or filterType = "Printer" Then
|
ElseIf filterType = "Access Point" Or filterType = "Printer" Then
|
||||||
' Access Point/Printer columns: Location, Name, Vendor, Model, IP Address, FQDN
|
' Access Point/Printer columns: Location, Name, Vendor, Model, IP Address, FQDN
|
||||||
Response.Write("<th scope='col'><i class='zmdi zmdi-pin'></i></th>")
|
Response.Write("<th scope='col'><i class='zmdi zmdi-pin'></i></th>")
|
||||||
@@ -238,9 +240,11 @@ End If
|
|||||||
If filterType = "IDF" Then
|
If filterType = "IDF" Then
|
||||||
' Description, Actions
|
' Description, Actions
|
||||||
Response.Write("<td>")
|
Response.Write("<td>")
|
||||||
If Not IsNull(rs("description")) And rs("description") <> "" Then
|
Dim descValue
|
||||||
|
descValue = rs("description") & ""
|
||||||
|
If Len(Trim(descValue)) > 0 Then
|
||||||
Dim desc
|
Dim desc
|
||||||
desc = Server.HTMLEncode(rs("description"))
|
desc = Server.HTMLEncode(Trim(descValue))
|
||||||
If Len(desc) > 100 Then
|
If Len(desc) > 100 Then
|
||||||
Response.Write(Left(desc, 100) & "...")
|
Response.Write(Left(desc, 100) & "...")
|
||||||
Else
|
Else
|
||||||
@@ -252,7 +256,7 @@ End If
|
|||||||
Response.Write("</td>")
|
Response.Write("</td>")
|
||||||
|
|
||||||
ElseIf filterType = "Server" Or filterType = "Switch" Then
|
ElseIf filterType = "Server" Or filterType = "Switch" Then
|
||||||
' Vendor, Model, Serial, IP Address, Description, Actions
|
' Vendor, Model, Serial, IP Address, FQDN, Description, Actions
|
||||||
Response.Write("<td>")
|
Response.Write("<td>")
|
||||||
If Not IsNull(rs("vendor")) Then
|
If Not IsNull(rs("vendor")) Then
|
||||||
Response.Write(Server.HTMLEncode(rs("vendor")))
|
Response.Write(Server.HTMLEncode(rs("vendor")))
|
||||||
@@ -288,9 +292,19 @@ End If
|
|||||||
Response.Write("</td>")
|
Response.Write("</td>")
|
||||||
|
|
||||||
Response.Write("<td>")
|
Response.Write("<td>")
|
||||||
If Not IsNull(rs("description")) And rs("description") <> "" Then
|
If Not IsNull(rs("fqdn")) And rs("fqdn") <> "" Then
|
||||||
|
Response.Write(Server.HTMLEncode(rs("fqdn")))
|
||||||
|
Else
|
||||||
|
Response.Write("<span class='text-muted'>-</span>")
|
||||||
|
End If
|
||||||
|
Response.Write("</td>")
|
||||||
|
|
||||||
|
Response.Write("<td>")
|
||||||
|
Dim descSvrValue
|
||||||
|
descSvrValue = rs("description") & ""
|
||||||
|
If Len(Trim(descSvrValue)) > 0 Then
|
||||||
Dim descSvr
|
Dim descSvr
|
||||||
descSvr = Server.HTMLEncode(rs("description"))
|
descSvr = Server.HTMLEncode(Trim(descSvrValue))
|
||||||
If Len(descSvr) > 50 Then
|
If Len(descSvr) > 50 Then
|
||||||
Response.Write(Left(descSvr, 50) & "...")
|
Response.Write(Left(descSvr, 50) & "...")
|
||||||
Else
|
Else
|
||||||
@@ -302,7 +316,7 @@ End If
|
|||||||
Response.Write("</td>")
|
Response.Write("</td>")
|
||||||
|
|
||||||
ElseIf filterType = "Camera" Then
|
ElseIf filterType = "Camera" Then
|
||||||
' IDF, Vendor, Model, MAC Address, IP Address, Actions
|
' IDF, Vendor, Model, MAC Address, IP Address, FQDN, Actions
|
||||||
Response.Write("<td>")
|
Response.Write("<td>")
|
||||||
If Not IsNull(rs("idfname")) Then
|
If Not IsNull(rs("idfname")) Then
|
||||||
Response.Write("<a href='deviceidf.asp?id=" & rs("idfid") & "'>")
|
Response.Write("<a href='deviceidf.asp?id=" & rs("idfid") & "'>")
|
||||||
@@ -347,6 +361,14 @@ End If
|
|||||||
End If
|
End If
|
||||||
Response.Write("</td>")
|
Response.Write("</td>")
|
||||||
|
|
||||||
|
Response.Write("<td>")
|
||||||
|
If Not IsNull(rs("fqdn")) And rs("fqdn") <> "" Then
|
||||||
|
Response.Write(Server.HTMLEncode(rs("fqdn")))
|
||||||
|
Else
|
||||||
|
Response.Write("<span class='text-muted'>-</span>")
|
||||||
|
End If
|
||||||
|
Response.Write("</td>")
|
||||||
|
|
||||||
ElseIf filterType = "Access Point" Or filterType = "Printer" Then
|
ElseIf filterType = "Access Point" Or filterType = "Printer" Then
|
||||||
' Access Point/Printer - Name (already shown), Vendor, Model, IP Address, FQDN, Actions
|
' Access Point/Printer - Name (already shown), Vendor, Model, IP Address, FQDN, Actions
|
||||||
Response.Write("<td>")
|
Response.Write("<td>")
|
||||||
@@ -420,9 +442,11 @@ End If
|
|||||||
Response.Write("</td>")
|
Response.Write("</td>")
|
||||||
|
|
||||||
Response.Write("<td>")
|
Response.Write("<td>")
|
||||||
If Not IsNull(rs("description")) And rs("description") <> "" Then
|
Dim descAllValue
|
||||||
|
descAllValue = rs("description") & ""
|
||||||
|
If Len(Trim(descAllValue)) > 0 Then
|
||||||
Dim descAll
|
Dim descAll
|
||||||
descAll = Server.HTMLEncode(rs("description"))
|
descAll = Server.HTMLEncode(Trim(descAllValue))
|
||||||
If Len(descAll) > 50 Then
|
If Len(descAll) > 50 Then
|
||||||
Response.Write(Left(descAll, 50) & "...")
|
Response.Write(Left(descAll, 50) & "...")
|
||||||
Else
|
Else
|
||||||
@@ -447,13 +471,13 @@ End If
|
|||||||
colspanCount = "3"
|
colspanCount = "3"
|
||||||
Case "Server":
|
Case "Server":
|
||||||
noDataMessage = "No servers found."
|
noDataMessage = "No servers found."
|
||||||
colspanCount = "7"
|
colspanCount = "8"
|
||||||
Case "Switch":
|
Case "Switch":
|
||||||
noDataMessage = "No switches found."
|
noDataMessage = "No switches found."
|
||||||
colspanCount = "7"
|
colspanCount = "8"
|
||||||
Case "Camera":
|
Case "Camera":
|
||||||
noDataMessage = "No cameras found."
|
noDataMessage = "No cameras found."
|
||||||
colspanCount = "7"
|
colspanCount = "8"
|
||||||
Case "Access Point":
|
Case "Access Point":
|
||||||
noDataMessage = "No access points found."
|
noDataMessage = "No access points found."
|
||||||
colspanCount = "6"
|
colspanCount = "6"
|
||||||
|
|||||||
@@ -426,21 +426,19 @@ function clearSelection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function downloadInstaller() {
|
function downloadInstaller() {
|
||||||
var printerNames = [];
|
var printerIds = [];
|
||||||
for (var printerId in selectedPrinters) {
|
for (var printerId in selectedPrinters) {
|
||||||
printerNames.push(printerData[printerId].name);
|
printerIds.push(printerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (printerNames.length === 0) {
|
if (printerIds.length === 0) {
|
||||||
alert('Please select at least one printer');
|
alert('Please select at least one printer');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass printer names as comma-separated list for auto-selection
|
// Pass printer IDs for reliable lookup (names are generated dynamically and may not match DB)
|
||||||
// Single printer: /PRINTER=PrinterName (uses partial matching)
|
var printerParam = printerIds.join(',');
|
||||||
// Multiple printers: /PRINTER=Printer1,Printer2,Printer3 (uses exact matching)
|
window.location.href = 'install_printer.asp?printerid=' + encodeURIComponent(printerParam);
|
||||||
var printerParam = printerNames.join(',');
|
|
||||||
window.location.href = 'install_printer.asp?printer=' + encodeURIComponent(printerParam);
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -127,10 +127,11 @@ Else
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
' Get model and serial number (common fields)
|
' Get model and serial number (common fields)
|
||||||
Dim modelid, serialnumber, ipaddress, macaddress
|
Dim modelid, serialnumber, ipaddress, fqdn, macaddress
|
||||||
modelid = Trim(Request.Form("modelid"))
|
modelid = Trim(Request.Form("modelid"))
|
||||||
serialnumber = Trim(Request.Form("serialnumber"))
|
serialnumber = Trim(Request.Form("serialnumber"))
|
||||||
ipaddress = Trim(Request.Form("ipaddress"))
|
ipaddress = Trim(Request.Form("ipaddress"))
|
||||||
|
fqdn = Trim(Request.Form("fqdn"))
|
||||||
macaddress = Trim(Request.Form("macaddress"))
|
macaddress = Trim(Request.Form("macaddress"))
|
||||||
|
|
||||||
' Handle new model creation
|
' Handle new model creation
|
||||||
@@ -325,7 +326,7 @@ strSQL = ""
|
|||||||
|
|
||||||
If deviceId = "0" Then
|
If deviceId = "0" Then
|
||||||
' INSERT into machines table
|
' INSERT into machines table
|
||||||
strSQL = "INSERT INTO machines (machinenumber, alias, modelnumberid, machinetypeid, pctypeid, serialnumber, machinenotes, mapleft, maptop, isactive, lastupdated) VALUES (?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, NOW())"
|
strSQL = "INSERT INTO machines (machinenumber, alias, modelnumberid, machinetypeid, pctypeid, serialnumber, fqdn, machinenotes, mapleft, maptop, isactive, lastupdated) VALUES (?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, NOW())"
|
||||||
Set cmdDevice = Server.CreateObject("ADODB.Command")
|
Set cmdDevice = Server.CreateObject("ADODB.Command")
|
||||||
cmdDevice.ActiveConnection = objConn
|
cmdDevice.ActiveConnection = objConn
|
||||||
cmdDevice.CommandText = strSQL
|
cmdDevice.CommandText = strSQL
|
||||||
@@ -335,6 +336,7 @@ If deviceId = "0" Then
|
|||||||
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@modelnumberid", 3, 1, , modelidValue)
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@modelnumberid", 3, 1, , modelidValue)
|
||||||
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@machinetypeid", 3, 1, , machineTypeId)
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@machinetypeid", 3, 1, , machineTypeId)
|
||||||
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@serialnumber", 200, 1, 100, serialnumber)
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@serialnumber", 200, 1, 100, serialnumber)
|
||||||
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@fqdn", 200, 1, 255, fqdn)
|
||||||
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@machinenotes", 200, 1, 255, description)
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@machinenotes", 200, 1, 255, description)
|
||||||
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@mapleft", 3, 1, , mapleftValue)
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@mapleft", 3, 1, , mapleftValue)
|
||||||
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@maptop", 3, 1, , maptopValue)
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@maptop", 3, 1, , maptopValue)
|
||||||
@@ -361,7 +363,7 @@ If deviceId = "0" Then
|
|||||||
|
|
||||||
Else
|
Else
|
||||||
' UPDATE machines table
|
' UPDATE machines table
|
||||||
strSQL = "UPDATE machines SET machinenumber = ?, alias = ?, modelnumberid = ?, serialnumber = ?, machinenotes = ?, mapleft = ?, maptop = ?, isactive = ?, lastupdated = NOW() WHERE machineid = ?"
|
strSQL = "UPDATE machines SET machinenumber = ?, alias = ?, modelnumberid = ?, serialnumber = ?, fqdn = ?, machinenotes = ?, mapleft = ?, maptop = ?, isactive = ?, lastupdated = NOW() WHERE machineid = ?"
|
||||||
Set cmdDevice = Server.CreateObject("ADODB.Command")
|
Set cmdDevice = Server.CreateObject("ADODB.Command")
|
||||||
cmdDevice.ActiveConnection = objConn
|
cmdDevice.ActiveConnection = objConn
|
||||||
cmdDevice.CommandText = strSQL
|
cmdDevice.CommandText = strSQL
|
||||||
@@ -370,6 +372,7 @@ Else
|
|||||||
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@alias", 200, 1, 100, deviceName)
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@alias", 200, 1, 100, deviceName)
|
||||||
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@modelnumberid", 3, 1, , modelidValue)
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@modelnumberid", 3, 1, , modelidValue)
|
||||||
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@serialnumber", 200, 1, 100, serialnumber)
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@serialnumber", 200, 1, 100, serialnumber)
|
||||||
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@fqdn", 200, 1, 255, fqdn)
|
||||||
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@machinenotes", 200, 1, 255, description)
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@machinenotes", 200, 1, 255, description)
|
||||||
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@mapleft", 3, 1, , mapleftValue)
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@mapleft", 3, 1, , mapleftValue)
|
||||||
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@maptop", 3, 1, , maptopValue)
|
cmdDevice.Parameters.Append cmdDevice.CreateParameter("@maptop", 3, 1, , maptopValue)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<div class="page">
|
<div class="page">
|
||||||
<%
|
<%
|
||||||
' Get and validate all inputs
|
' Get and validate all inputs
|
||||||
Dim machineid, modelid, businessunitid, alias, machinenotes, mapleft, maptop
|
Dim machineid, modelid, businessunitid, alias, machinenotes, mapleft, maptop, fqdn
|
||||||
machineid = Trim(Request.Form("machineid"))
|
machineid = Trim(Request.Form("machineid"))
|
||||||
modelid = Trim(Request.Form("modelid"))
|
modelid = Trim(Request.Form("modelid"))
|
||||||
businessunitid = Trim(Request.Form("businessunitid"))
|
businessunitid = Trim(Request.Form("businessunitid"))
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
machinenotes = Trim(Request.Form("machinenotes"))
|
machinenotes = Trim(Request.Form("machinenotes"))
|
||||||
mapleft = Trim(Request.Form("mapleft"))
|
mapleft = Trim(Request.Form("mapleft"))
|
||||||
maptop = Trim(Request.Form("maptop"))
|
maptop = Trim(Request.Form("maptop"))
|
||||||
|
fqdn = Trim(Request.Form("fqdn"))
|
||||||
|
|
||||||
' Get form inputs for new business unit
|
' Get form inputs for new business unit
|
||||||
Dim newbusinessunit
|
Dim newbusinessunit
|
||||||
@@ -388,13 +389,14 @@
|
|||||||
'=============================================================================
|
'=============================================================================
|
||||||
' UPDATE MACHINES TABLE
|
' UPDATE MACHINES TABLE
|
||||||
'=============================================================================
|
'=============================================================================
|
||||||
Dim strSQL, cmdMachine, serialnumberVal, hostnameVal, aliasVal, machinenotesVal
|
Dim strSQL, cmdMachine, serialnumberVal, hostnameVal, aliasVal, machinenotesVal, fqdnVal
|
||||||
If Trim(Request.Form("serialnumber") & "") <> "" Then serialnumberVal = Trim(Request.Form("serialnumber") & "") Else serialnumberVal = Null
|
If Trim(Request.Form("serialnumber") & "") <> "" Then serialnumberVal = Trim(Request.Form("serialnumber") & "") Else serialnumberVal = Null
|
||||||
If Trim(Request.Form("hostname") & "") <> "" Then hostnameVal = Trim(Request.Form("hostname") & "") Else hostnameVal = Null
|
If Trim(Request.Form("hostname") & "") <> "" Then hostnameVal = Trim(Request.Form("hostname") & "") Else hostnameVal = Null
|
||||||
If alias <> "" Then aliasVal = alias Else aliasVal = Null
|
If alias <> "" Then aliasVal = alias Else aliasVal = Null
|
||||||
If machinenotes <> "" Then machinenotesVal = machinenotes Else machinenotesVal = Null
|
If machinenotes <> "" Then machinenotesVal = machinenotes Else machinenotesVal = Null
|
||||||
|
If fqdn <> "" Then fqdnVal = fqdn Else fqdnVal = Null
|
||||||
|
|
||||||
strSQL = "UPDATE machines SET serialnumber = ?, hostname = ?, modelnumberid = ?, businessunitid = ?, alias = ?, machinenotes = ?, mapleft = ?, maptop = ? WHERE machineid = ?"
|
strSQL = "UPDATE machines SET serialnumber = ?, hostname = ?, fqdn = ?, modelnumberid = ?, businessunitid = ?, alias = ?, machinenotes = ?, mapleft = ?, maptop = ? WHERE machineid = ?"
|
||||||
|
|
||||||
Set cmdMachine = Server.CreateObject("ADODB.Command")
|
Set cmdMachine = Server.CreateObject("ADODB.Command")
|
||||||
cmdMachine.ActiveConnection = objConn
|
cmdMachine.ActiveConnection = objConn
|
||||||
@@ -402,6 +404,7 @@
|
|||||||
cmdMachine.CommandType = 1
|
cmdMachine.CommandType = 1
|
||||||
cmdMachine.Parameters.Append cmdMachine.CreateParameter("@serialnumber", 200, 1, 100, serialnumberVal)
|
cmdMachine.Parameters.Append cmdMachine.CreateParameter("@serialnumber", 200, 1, 100, serialnumberVal)
|
||||||
cmdMachine.Parameters.Append cmdMachine.CreateParameter("@hostname", 200, 1, 255, hostnameVal)
|
cmdMachine.Parameters.Append cmdMachine.CreateParameter("@hostname", 200, 1, 255, hostnameVal)
|
||||||
|
cmdMachine.Parameters.Append cmdMachine.CreateParameter("@fqdn", 200, 1, 255, fqdnVal)
|
||||||
cmdMachine.Parameters.Append cmdMachine.CreateParameter("@modelnumberid", 3, 1, , CLng(modelid))
|
cmdMachine.Parameters.Append cmdMachine.CreateParameter("@modelnumberid", 3, 1, , CLng(modelid))
|
||||||
cmdMachine.Parameters.Append cmdMachine.CreateParameter("@businessunitid", 3, 1, , CLng(businessunitid))
|
cmdMachine.Parameters.Append cmdMachine.CreateParameter("@businessunitid", 3, 1, , CLng(businessunitid))
|
||||||
cmdMachine.Parameters.Append cmdMachine.CreateParameter("@alias", 200, 1, 50, aliasVal)
|
cmdMachine.Parameters.Append cmdMachine.CreateParameter("@alias", 200, 1, 50, aliasVal)
|
||||||
|
|||||||
85
sql/add_fqdn_to_machines.sql
Normal file
85
sql/add_fqdn_to_machines.sql
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
-- =============================================================================
|
||||||
|
-- Migration: Add FQDN column to machines table
|
||||||
|
-- Purpose: Allow network devices to store fully qualified domain names
|
||||||
|
-- Date: 2025-12-01
|
||||||
|
--
|
||||||
|
-- Run on PRODUCTION:
|
||||||
|
-- mysql -u root -p shopdb < add_fqdn_to_machines.sql
|
||||||
|
-- =============================================================================
|
||||||
|
|
||||||
|
-- Check if column already exists before adding
|
||||||
|
SET @dbname = DATABASE();
|
||||||
|
SET @tablename = 'machines';
|
||||||
|
SET @columnname = 'fqdn';
|
||||||
|
SET @preparedStatement = (SELECT IF(
|
||||||
|
(
|
||||||
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = @dbname
|
||||||
|
AND TABLE_NAME = @tablename
|
||||||
|
AND COLUMN_NAME = @columnname
|
||||||
|
) > 0,
|
||||||
|
'SELECT ''Column fqdn already exists in machines table'' AS message;',
|
||||||
|
'ALTER TABLE machines ADD COLUMN fqdn VARCHAR(255) NULL AFTER hostname;'
|
||||||
|
));
|
||||||
|
|
||||||
|
PREPARE alterIfNotExists FROM @preparedStatement;
|
||||||
|
EXECUTE alterIfNotExists;
|
||||||
|
DEALLOCATE PREPARE alterIfNotExists;
|
||||||
|
|
||||||
|
-- Verify the column was added
|
||||||
|
SELECT 'Column migration complete.' AS status;
|
||||||
|
|
||||||
|
-- =============================================================================
|
||||||
|
-- Update vw_network_devices view to include FQDN from machines table
|
||||||
|
-- =============================================================================
|
||||||
|
CREATE OR REPLACE VIEW vw_network_devices AS
|
||||||
|
-- Printers from printers table
|
||||||
|
SELECT
|
||||||
|
'Printer' AS device_type,
|
||||||
|
p.printerid AS device_id,
|
||||||
|
p.printerwindowsname AS device_name,
|
||||||
|
p.modelid AS modelid,
|
||||||
|
m.modelnumber AS modelnumber,
|
||||||
|
v.vendor AS vendor,
|
||||||
|
p.serialnumber AS serialnumber,
|
||||||
|
p.ipaddress AS ipaddress,
|
||||||
|
NULL AS description,
|
||||||
|
p.maptop AS maptop,
|
||||||
|
p.mapleft AS mapleft,
|
||||||
|
p.isactive AS isactive,
|
||||||
|
NULL AS idfid,
|
||||||
|
NULL AS idfname,
|
||||||
|
NULL AS macaddress,
|
||||||
|
p.fqdn AS fqdn
|
||||||
|
FROM printers p
|
||||||
|
LEFT JOIN models m ON p.modelid = m.modelnumberid
|
||||||
|
LEFT JOIN vendors v ON m.vendorid = v.vendorid
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
-- Network devices from machines table (machinetypeid 16-20)
|
||||||
|
SELECT
|
||||||
|
mt.machinetype AS device_type,
|
||||||
|
ma.machineid AS device_id,
|
||||||
|
COALESCE(ma.alias, ma.machinenumber) AS device_name,
|
||||||
|
ma.modelnumberid AS modelid,
|
||||||
|
mo.modelnumber AS modelnumber,
|
||||||
|
ve.vendor AS vendor,
|
||||||
|
ma.serialnumber AS serialnumber,
|
||||||
|
c.address AS ipaddress,
|
||||||
|
ma.machinenotes AS description,
|
||||||
|
ma.maptop AS maptop,
|
||||||
|
ma.mapleft AS mapleft,
|
||||||
|
ma.isactive AS isactive,
|
||||||
|
NULL AS idfid,
|
||||||
|
NULL AS idfname,
|
||||||
|
c.macaddress AS macaddress,
|
||||||
|
ma.fqdn AS fqdn
|
||||||
|
FROM machines ma
|
||||||
|
JOIN machinetypes mt ON ma.machinetypeid = mt.machinetypeid
|
||||||
|
LEFT JOIN models mo ON ma.modelnumberid = mo.modelnumberid
|
||||||
|
LEFT JOIN vendors ve ON mo.vendorid = ve.vendorid
|
||||||
|
LEFT JOIN communications c ON ma.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1
|
||||||
|
WHERE mt.machinetypeid IN (16, 17, 18, 19, 20);
|
||||||
|
|
||||||
|
SELECT 'View vw_network_devices updated to include FQDN from machines table.' AS status;
|
||||||
Reference in New Issue
Block a user