+
+
+ Link to this device in Logic Monitor (optional)
+
+
+
+
diff --git a/devicecamera.asp b/devicecamera.asp
index 6d99124..2dbf2b5 100644
--- a/devicecamera.asp
+++ b/devicecamera.asp
@@ -63,8 +63,8 @@
Else
ipaddress = ""
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("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
@@ -231,12 +231,13 @@
<%
- Dim strSQL3, rsModels
- ' Filter models to only show Camera models (machinetypeid = 18)
+ Dim strSQL3, rsModels, currentModelId
+ ' Show Camera models (machinetypeid = 18) plus currently assigned model
+ If IsNumeric(modelid) Then currentModelId = CLng(modelid) Else currentModelId = 0
strSQL3 = "SELECT m.modelnumberid, m.modelnumber, v.vendor " & _
"FROM models m " & _
"INNER JOIN vendors v ON m.vendorid = v.vendorid " & _
- "WHERE m.isactive = 1 AND m.machinetypeid = 18 " & _
+ "WHERE m.isactive = 1 AND (m.machinetypeid = 18 OR m.modelnumberid = " & currentModelId & ") " & _
"ORDER BY v.vendor, m.modelnumber"
Set rsModels = objConn.Execute(strSQL3)
Do While Not rsModels.EOF
diff --git a/deviceidf.asp b/deviceidf.asp
index e8d5afa..98d77ed 100644
--- a/deviceidf.asp
+++ b/deviceidf.asp
@@ -36,8 +36,8 @@
Response.End
End If
- If Not IsNull(rs("idfname")) Then idfname = rs("idfname") Else idfname = ""
- If Not IsNull(rs("description")) Then description = rs("description") Else description = ""
+ If Not IsNull(rs("idfname")) Then idfname = rs("idfname") & "" Else idfname = ""
+ 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
diff --git a/deviceserver.asp b/deviceserver.asp
index 737306d..2291a2e 100644
--- a/deviceserver.asp
+++ b/deviceserver.asp
@@ -23,11 +23,11 @@
' If editing, fetch existing data
Dim rs, servername, modelid, serialnumber, ipaddress, fqdn, description, maptop, mapleft, isactive
- Dim vendorname, modelnumber
+ Dim vendorname, modelnumber, logicmonitorurl
If Not isNewRecord Then
Dim strSQL
strSQL = "SELECT mac.machineid, mac.alias AS servername, mac.modelnumberid AS modelid, " & _
- "mac.serialnumber, mac.fqdn, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
+ "mac.serialnumber, mac.fqdn, mac.logicmonitorurl, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
"m.modelnumber, v.vendor, c.address AS ipaddress " & _
"FROM machines mac " & _
"LEFT JOIN models m ON mac.modelnumberid = m.modelnumberid " & _
@@ -47,7 +47,8 @@
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("fqdn")) Then fqdn = rs("fqdn") & "" Else fqdn = ""
- If Not IsNull(rs("description")) Then description = rs("description") & "" Else description = ""
+ If Not IsNull(rs("logicmonitorurl")) Then logicmonitorurl = rs("logicmonitorurl") & "" Else logicmonitorurl = ""
+ 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
@@ -63,6 +64,7 @@
serialnumber = ""
ipaddress = ""
fqdn = ""
+ logicmonitorurl = ""
description = ""
maptop = ""
mapleft = ""
@@ -135,12 +137,13 @@
<%
- Dim strSQL2, rsModels
- ' Filter models to only show Server models (machinetypeid = 20)
+ Dim strSQL2, rsModels, currentModelId
+ ' Show Server models (machinetypeid = 20) plus currently assigned model
+ If IsNumeric(modelid) Then currentModelId = CLng(modelid) Else currentModelId = 0
strSQL2 = "SELECT m.modelnumberid, m.modelnumber, v.vendor " & _
"FROM models m " & _
"INNER JOIN vendors v ON m.vendorid = v.vendorid " & _
- "WHERE m.isactive = 1 AND m.machinetypeid = 20 " & _
+ "WHERE m.isactive = 1 AND (m.machinetypeid = 20 OR m.modelnumberid = " & currentModelId & ") " & _
"ORDER BY v.vendor, m.modelnumber"
Set rsModels = objConn.Execute(strSQL2)
Do While Not rsModels.EOF
@@ -301,6 +304,19 @@
+
+
+
+
+
+ Link to this device in Logic Monitor (optional)
+
+
+
+
@@ -312,6 +328,74 @@
+<%If Not isNewRecord Then%>
+
+
+
+
+<%
+ ' Query applications currently assigned to this server
+ Dim rsCurrentApps, strAppSQL
+ strAppSQL = "SELECT ia.installedappid, a.appid, a.appname " & _
+ "FROM installedapps ia " & _
+ "INNER JOIN applications a ON ia.appid = a.appid " & _
+ "WHERE ia.machineid = " & CLng(serverid) & " AND ia.isactive = 1 " & _
+ "ORDER BY a.appname"
+ Set rsCurrentApps = objConn.Execute(strAppSQL)
+ If Not rsCurrentApps.EOF Then
+ Do While Not rsCurrentApps.EOF
+%>
+
+ <%=Server.HTMLEncode(rsCurrentApps("appname") & "")%>
+ ">
+
+
+<%
+ rsCurrentApps.MoveNext
+ Loop
+ Else
+%>
+ No applications assigned
+<%
+ End If
+ rsCurrentApps.Close
+ Set rsCurrentApps = Nothing
+%>
+
+
+
+
+<%
+ ' Query all available applications
+ Dim rsAllApps
+ strAppSQL = "SELECT appid, appname FROM applications WHERE isactive = 1 ORDER BY appname"
+ Set rsAllApps = objConn.Execute(strAppSQL)
+ Do While Not rsAllApps.EOF
+%>
+
+<%
+ rsAllApps.MoveNext
+ Loop
+ rsAllApps.Close
+ Set rsAllApps = Nothing
+%>
+
+
+
+
+
+
+ Select applications hosted on this server
+
+
+
+
+
+<%End If%>
+
@@ -496,6 +580,63 @@ $(document).ready(function() {
}
}
});
+
+ // Application management
+ var addedApps = [];
+ var removedApps = [];
+
+ // Add application
+ $('#addAppBtn').on('click', function() {
+ var appId = $('#addAppSelect').val();
+ var appName = $('#addAppSelect option:selected').text();
+ if (appId && appId !== '') {
+ // Check if already added or already exists
+ if ($('#currentApps').find('[data-appid="' + appId + '"]').length > 0) {
+ alert('This application is already assigned to this server');
+ return;
+ }
+ if (addedApps.indexOf(appId) >= 0) {
+ alert('This application has already been added');
+ return;
+ }
+ addedApps.push(appId);
+ $('#appsInput').val(addedApps.join(','));
+
+ // Add badge
+ var badge = $('' +
+ appName +
+ '' +
+ '');
+ if ($('#currentApps').find('.text-muted').length > 0) {
+ $('#currentApps').html('');
+ }
+ $('#currentApps').append(badge);
+ $('#addAppSelect').val('');
+ }
+ });
+
+ // Remove newly added application
+ $(document).on('click', '.btn-remove-new-app', function() {
+ var appId = $(this).data('appid').toString();
+ addedApps = addedApps.filter(function(id) { return id !== appId; });
+ $('#appsInput').val(addedApps.join(','));
+ $(this).parent().remove();
+ if ($('#currentApps').children().length === 0) {
+ $('#currentApps').html('No applications assigned');
+ }
+ });
+
+ // Remove existing application
+ $(document).on('click', '.btn-remove-app', function() {
+ var appId = $(this).data('appid').toString();
+ removedApps.push(appId);
+ $('#removedAppsInput').val(removedApps.join(','));
+ $(this).parent().remove();
+ if ($('#currentApps').children().length === 0) {
+ $('#currentApps').html('No applications assigned');
+ }
+ });
});
diff --git a/deviceswitch.asp b/deviceswitch.asp
index c6a861f..319a941 100644
--- a/deviceswitch.asp
+++ b/deviceswitch.asp
@@ -23,11 +23,11 @@
' If editing, fetch existing data
Dim rs, switchname, modelid, serialnumber, ipaddress, fqdn, description, maptop, mapleft, isactive
- Dim vendorname, modelnumber
+ Dim vendorname, modelnumber, logicmonitorurl
If Not isNewRecord Then
Dim strSQL
strSQL = "SELECT mac.machineid, mac.alias AS switchname, mac.modelnumberid AS modelid, " & _
- "mac.serialnumber, mac.fqdn, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
+ "mac.serialnumber, mac.fqdn, mac.logicmonitorurl, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _
"m.modelnumber, v.vendor, c.address AS ipaddress " & _
"FROM machines mac " & _
"LEFT JOIN models m ON mac.modelnumberid = m.modelnumberid " & _
@@ -45,8 +45,9 @@
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("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("fqdn")) Then fqdn = rs("fqdn") & "" Else fqdn = ""
+ If Not IsNull(rs("logicmonitorurl")) Then logicmonitorurl = rs("logicmonitorurl") & "" Else logicmonitorurl = ""
+ 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
@@ -62,6 +63,7 @@
serialnumber = ""
ipaddress = ""
fqdn = ""
+ logicmonitorurl = ""
description = ""
maptop = ""
mapleft = ""
@@ -134,12 +136,13 @@
<%
- Dim strSQL2, rsModels
- ' Filter models to only show Switch models (machinetypeid = 19)
+ Dim strSQL2, rsModels, currentModelId
+ ' Show Switch models (machinetypeid = 19) plus currently assigned model
+ If IsNumeric(modelid) Then currentModelId = CLng(modelid) Else currentModelId = 0
strSQL2 = "SELECT m.modelnumberid, m.modelnumber, v.vendor " & _
"FROM models m " & _
"INNER JOIN vendors v ON m.vendorid = v.vendorid " & _
- "WHERE m.isactive = 1 AND m.machinetypeid = 19 " & _
+ "WHERE m.isactive = 1 AND (m.machinetypeid = 19 OR m.modelnumberid = " & currentModelId & ") " & _
"ORDER BY v.vendor, m.modelnumber"
Set rsModels = objConn.Execute(strSQL2)
Do While Not rsModels.EOF
@@ -300,6 +303,19 @@
+
+
+
+
+
+ Link to this device in Logic Monitor (optional)
+
+
+
+
diff --git a/displayapplication.asp b/displayapplication.asp
index 0de2199..a17f4b6 100644
--- a/displayapplication.asp
+++ b/displayapplication.asp
@@ -1,12 +1,17 @@
<%@ Language=VBScript %>
-<%
-Option Explicit
-%>
<%
- Dim appid, rs
+ Dim appid, rs, theme, kbClicks, kbDesc, kbClicksNum
+ Dim strSQL, installPath, docPath, appLink, teamUrl
+ Dim rsKB, sqlKB, appName, rsSupportTeams, sqlSupportTeams
+ Dim rsAppOwners, sqlAppOwners
+
appid = Request.Querystring("appid")
+ ' Get highlight parameter for shared links
+ Dim highlightId
+ highlightId = Request.QueryString("highlight")
+
' Basic validation - must be numeric and positive
If Not IsNumeric(appid) Or CLng(appid) < 1 Then
Response.Redirect("displayapplications.asp")
@@ -15,14 +20,12 @@ Option Explicit
appid = CLng(appid) ' Convert to long integer
- Dim theme
theme = Request.Cookies("theme")
IF theme = "" THEN
theme="bg-theme1"
END IF
' Simple query with validated integer
- Dim strSQL
strSQL = "SELECT a.*, s.teamname, s.teamurl, o.appowner, o.sso " & _
"FROM applications a " & _
"INNER JOIN supportteams s ON a.supportteamid = s.supporteamid " & _
@@ -43,11 +46,80 @@ Option Explicit
+
<%
- ' Query knowledge base articles for this application
- ' Use keyword matching similar to search.asp - match on app name in keywords/description
- Dim rsKB, sqlKB, appName
- appName = rs("appname") & ""
-
- ' Search for articles where keywords or shortdescription contain the app name
- ' Also include articles explicitly linked via appid
- ' Sort by clicks (highest first), then prioritize directly linked articles
- sqlKB = "SELECT linkid, linkurl, shortdescription, COALESCE(clicks, 0) as clicks, " & _
- "CASE WHEN appid = " & appid & " THEN 1 ELSE 0 END as direct_link, " & _
- "CAST(COALESCE(clicks, 0) AS SIGNED) as clicks_num " & _
+ ' Query knowledge base articles directly linked to this application
+ sqlKB = "SELECT linkid, linkurl, shortdescription, COALESCE(clicks, 0) as clicks " & _
"FROM knowledgebase " & _
- "WHERE isactive = 1 " & _
- "AND (appid = " & appid & " " & _
- " OR keywords LIKE '%" & Replace(appName, "'", "''") & "%' " & _
- " OR shortdescription LIKE '%" & Replace(appName, "'", "''") & "%') " & _
- "ORDER BY clicks_num DESC, direct_link DESC"
+ "WHERE isactive = 1 AND appid = " & appid & " " & _
+ "ORDER BY clicks DESC"
Set rsKB = objConn.Execute(sqlKB)
If Not rsKB.EOF Then
@@ -183,16 +247,12 @@ Option Explicit
Article
-
- Clicks
-
+
Clicks
+
Share
<%
- ' Declare loop variables once outside the loop
- Dim kbClicks, kbDesc, kbClicksNum
-
While Not rsKB.EOF
' Get click count with proper error handling
On Error Resume Next
@@ -214,14 +274,22 @@ Option Explicit
kbDesc = "[No description]"
End If
On Error Goto 0
+
+ ' Check if this row should be highlighted
+ Dim rowClass, kbLinkId
+ kbLinkId = rsKB("linkid")
+ rowClass = ""
+ If highlightId <> "" And CStr(kbLinkId) = CStr(highlightId) Then
+ rowClass = " class='highlighted-result'"
+ End If
%>
-
<%
rsKB.MoveNext
@@ -288,7 +361,6 @@ Option Explicit
<%
' Get all support teams for dropdown (same pattern as displayprinter.asp)
- Dim rsSupportTeams, sqlSupportTeams
sqlSupportTeams = "SELECT supporteamid, teamname FROM supportteams WHERE isactive=1 ORDER BY teamname ASC"
Set rsSupportTeams = objconn.Execute(sqlSupportTeams)
While Not rsSupportTeams.EOF
@@ -332,7 +404,6 @@ Option Explicit
<%
- Dim rsAppOwners, sqlAppOwners
sqlAppOwners = "SELECT appownerid, appowner FROM appowners WHERE isactive=1 ORDER BY appowner ASC"
Set rsAppOwners = objconn.Execute(sqlAppOwners)
While Not rsAppOwners.EOF
@@ -529,7 +600,61 @@ Option Explicit
+
+