% theme = Request.Cookies("theme") IF theme = "" THEN theme="bg-theme1" END IF Dim cameraid, isNewRecord cameraid = Request.QueryString("id") If cameraid = "" Or cameraid = "0" Then isNewRecord = True cameraid = 0 Else isNewRecord = False End If ' If editing, fetch existing data Dim rs, cameraname, modelid, idfid, serialnumber, macaddress, ipaddress, fqdn, description, maptop, mapleft, isactive Dim vendorname, modelnumber, idfname If Not isNewRecord Then Dim strSQL strSQL = "SELECT mac.machineid, mac.alias AS cameraname, mac.modelnumberid AS modelid, " & _ "mac.serialnumber, mac.fqdn, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _ "m.modelnumber, v.vendor, c.address AS ipaddress, c.macaddress, " & _ "mr.related_machineid AS idfid, idf.alias AS idfname " & _ "FROM machines mac " & _ "LEFT JOIN models m ON mac.modelnumberid = m.modelnumberid " & _ "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 machinerelationships mr ON mac.machineid = mr.machineid AND mr.relationshiptypeid = " & _ "(SELECT relationshiptypeid FROM relationshiptypes WHERE relationshiptype = 'Connected To' LIMIT 1) " & _ "LEFT JOIN machines idf ON mr.related_machineid = idf.machineid AND idf.machinetypeid = 17 " & _ "WHERE mac.machineid = " & cameraid & " AND mac.machinetypeid = 18" Set rs = objConn.Execute(strSQL) If rs.EOF Then Response.Write("Camera not found") Response.End End If If Not IsNull(rs("cameraname")) Then cameraname = rs("cameraname") Else cameraname = "" If Not IsNull(rs("modelid")) Then modelid = rs("modelid") Else modelid = "" If Not IsNull(rs("idfid")) Then idfid = rs("idfid") Else idfid = "" End If If Not IsNull(rs("serialnumber")) Then serialnumber = rs("serialnumber") Else serialnumber = "" If Not IsNull(rs("macaddress")) Then macaddress = rs("macaddress") Else macaddress = "" End If If Not IsNull(rs("ipaddress")) Then ipaddress = rs("ipaddress") Else ipaddress = "" End If If Not IsNull(rs("fqdn")) Then fqdn = rs("fqdn") & "" Else fqdn = "" description = rs("description") & "" 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("isactive")) Then isactive = rs("isactive") Else isactive = 1 If Not IsNull(rs("vendor")) Then vendorname = rs("vendor") Else vendorname = "" If Not IsNull(rs("modelnumber")) Then modelnumber = rs("modelnumber") Else modelnumber = "" If Not IsNull(rs("idfname")) Then idfname = rs("idfname") Else idfname = "" End If rs.Close Set rs = Nothing Else ' New record defaults cameraname = "" modelid = "" idfid = "" serialnumber = "" macaddress = "" ipaddress = "" fqdn = "" description = "" maptop = "" mapleft = "" isactive = 1 ' Active by default for new records vendorname = "" modelnumber = "" idfname = "" End If %>