JSON Handling in JavaScript Code
JSON Handling in JavaScript Code
WriteHtml("\n");
var JSON = function () {
var m = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
s = {
'boolean': function (x) {
return String(x);
},
number: function (x) {
return isFinite(x) ? String(x) : 'null';
},
string: function (x) {
if (/["\\\x00-\x1f]/.test(x)) {
x = [Link](/([\x00-\x1f\\"])/g, function(a, b) {
var c = m[b];
if (c) {
return c;
}
c = [Link]();
return '\\u00' +
[Link](c / 16).toString(16) +
(c % 16).toString(16);
});
}
return '"' + x + '"';
},
object: function (x) {
if (x) {
var a = [], b, f, i, l, v;
if (x instanceof Array) {
a[0] = '[';
l = [Link];
for (i = 0; i < l; i += 1) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[[Link]] = ',';
}
a[[Link]] = v;
b = true;
}
}
}
a[[Link]] = ']';
} else if (x instanceof Object) {
a[0] = '{';
for (i in x) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[[Link]] = ',';
}
[Link]([Link](i), ':', v);
b = true;
}
}
}
a[[Link]] = '}';
} else {
return;
}
return [Link]('');
}
return 'null';
}
};
return {
copyright: '(c)2005 [Link]',
license: '[Link]
/*
Stringify a JavaScript value, producing a JSON text.
*/
ToString: function (v) {
var f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
return v;
}
}
return null;
},
/*
FromString a JSON text, producing a JavaScript value.
It returns false if there is a syntax error.
*/
FromString: function (text) {
try {
return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
[Link](/"(\\.|[^"\\])*"/g, ''))) &&
eval('(' + text + ')');
} catch (e) {
return null;
}
}
};
}();
//'
//' Returns true if the sent JSON string is a legal, non-empty string.
//'
function IsJsonString(jsonString)
{
return null != jsonString && "" != jsonString && "[]" != jsonString;
}
[Link]("\n");
//--// sends the result to the client and halts processing of the page
//--function SendResult(oResponse)
{
oResponse.m_bSuccess = true;
oResponse.m_sErrorMsg="";
var sResultText = [Link](oResponse);
if(sResultText==false)
{
return false;
}
[Link]();
[Link](sResultText);
[Link]();
return true;
}
//--// sends an error to the client and halts processing of the page
//--function SendError(sErrorMsg)
{
var oResponse = new Object();
oResponse.m_bSuccess = false;
oResponse.m_sErrorMsg = sErrorMsg;
var sResultText = [Link](oResponse);
if(sResultText==false)
{
return false;
}
[Link]();
[Link](sResultText);
[Link]();
return true;
}
//--// create and load the oRequest object
//--function InitializeRequest()
{
var sJson = [Link]("oRequest").Item;
if(sJson==null)
{
SendError("Invalid Request");
return null;
}
sJson = decodeURIComponent(sJson);
var oRequest = [Link](sJson);
if(oRequest==null)
{
SendError("Invalid Request");
return null;
}
return oRequest;
}
//--// create and initialize the response object
//--function InitializeResponse()
{
var oResponse = new Object();
oResponse.m_bSuccess=false;
oResponse.m_sErrorMsg=null;
return oResponse;
}
[Link]("\n");
var nWebUserID = parseInt(Session("nWebUserID"));
if(isNaN(nWebUserID))
{
[Link]();
}
[Link]("\n");
[Link]("<script language=\"JavaScript\" src=\"/NmConsole/Core/AspFor
ms/[Link]\"></script>\n<script language=\"javascript\" src=\"/NmConsole/Co
re/AspForms/[Link]\"></script>\n");
[Link]("<script language=\"javascript\" src=\"/NmConsole/Core/Ajax/P
[Link]\"></script>\n<script language=\"javascript\" src=\"/NmConsole/Core/A
jax/[Link]\"></script>\n<script language=\"javascript\" src=\"/NmConsole/Core/A
jax/[Link]\"></script>\n");
function Ajax()
{
}
//--// asynchronously loads the contents of sUrl into the html element specified by
sElementID
// returns the result HTML as a string
//--[Link]=function(sElementID,sUrl,sInitialText)
{
var sHtml = "<script>[Link](\"" + sElementID + "\",\"" + sUrl
+ "\",\"" + sInitialText + "\")</script>";
return sHtml;
}
//--// creates a SPAN html element and asynchronously loads the contents from sUrl
// returns the result HTML as a string
//--[Link]=function(sElementID,sUrl,sInitialText)
{
a[[Link]] = ']';
} else if (x instanceof Object) {
a[0] = '{';
for (i in x) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[[Link]] = ',';
}
[Link]([Link](i), ':', v);
b = true;
}
}
}
a[[Link]] = '}';
} else {
return;
}
return [Link]('');
}
return 'null';
}
};
return {
copyright: '(c)2005 [Link]',
license: '[Link]
/*
Stringify a JavaScript value, producing a JSON text.
*/
ToString: function (v) {
var f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
return v;
}
}
return null;
},
/*
FromString a JSON text, producing a JavaScript value.
It returns false if there is a syntax error.
*/
FromString: function (text) {
try {
return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
[Link](/"(\\.|[^"\\])*"/g, ''))) &&
eval('(' + text + ')');
} catch (e) {
return null;
}
}
};
}();
//'
//' Returns true if the sent JSON string is a legal, non-empty string.
//'
function IsJsonString(jsonString)
{
return null != jsonString && "" != jsonString && "[]" != jsonString;
}
[Link]("\n\n");
//--// asynchronously loads the contents of sUrl into the html element specified by
sElementID
//--function [Link](sElementID,sUrl,sInitialText)
{
var sHtml = [Link](sElementID,sUrl,sInitialText);
[Link](sHtml);
}
//--// creates a SPAN html element and asynchronously loads the contents from sUrl
//--function [Link](sElementID,sUrl,sInitialText)
{
var sHtml = [Link](sElementID,sUrl,sInitialText);
[Link](sHtml);
}
[Link]("\n");
[Link]("\n\n");
var oAspForm = [Link]("[Link]");
[Link](Server,Request,Response,Session);
var nTranslationLanguageID = parseInt(Session("nTranslationLanguageID"));
if(isNaN(nTranslationLanguageID))
{
//default to the admin language id
var oDb = [Link]("[Link]");
var sSql = "SELECT nLanguageID FROM WebUser WHERE nWebUserID=" + 1;
var oResult = [Link](sSql);
if([Link])
{
nTranslationLanguageID=1033;
}
else
{
if(![Link])
{
nTranslationLanguageID=[Link]("nLanguageID")
;
}
if(isNaN(nTranslationLanguageID))
{
nTranslationLanguageID=1033;
}
}
Session("nTranslationLanguageID")=nTranslationLanguageID;
}
if(sRequestDataType != null)
{
[Link]("\n
<tr bgcolor=\"DDDDDD\">\n
<td class=\"rs-headerCell2\">");
[Link](sRequestDataType
);[Link](" Variable</td>\n
<td class=\"rs-h
eaderCell2\">Value</td>\n
</tr>");
while(![Link]())
{
var sItemName = [Link]()
var sItemValue = eval("Request." + sRequestDataT
ype + "(sItemName)");
[Link]("\n
<td valign=\"top\">");
[Link](sItemName
);[Link]("</td>\n
[Link](sItemValue
);[Link](" </td>\n
<tr>\n
<td>");
</tr>");
[Link]();
}
}
[Link]("\n
<tr bgcolor=\"DDDDDD\">\n
<td class=\"rs-headerCell2\">Misc Items</td>\n
<td class=\"rs-h
eaderCell2\">Value</td>\n
</tr>\n
<tr>\n
<td>.IsPostBack</td>\n
<td>");
[Link]([Link]
);[Link]("</td>\n
</tr>\n
<tr>\n
<td>Is self post</td>\n
<td>");
[Link]([Link]
);[Link]("</td>\n
</tr>\n
<tr>\n
<td>Current form name</td>\n
<td>");
[Link]([Link]
);[Link]("</td>\n
</tr>\n
<tr bgcolor=\"DDDDDD\">\
n
<td class=\"rs-headerCell2\">Server Variables</td>\n
<td class=\"rs-headerCell2\">Value</td>\n
</tr> ");
var oEnum = new Enumerator([Link]);
while(![Link]())
{
var sItemName = [Link]()
var sItemValue = [Link](sItemName);
if(sItemValue == "")
sItemValue = " ";
[Link]("\n
<tr>\n
<td vali
gn=\"top\">");
[Link](sItemName
);[Link]("</td>\n
<td><pre style=\"margin:
0px;\">");
[Link](sItemValue
);[Link]("</pre></td>\n
</tr>");
[Link]();
}
var sXmlViewState = "" + [Link]("__VIEWSTATE");
sXmlViewState = decodeURI(sXmlViewState);
sXmlViewState=[Link](/\&/g, "&").replace(/</g
, "<").replace(/>/g, ">");
[Link]("\n
<tr bgcolor=\"DDDDDD\">\n
<td class=\"rs-headerCell2\">__VIEWSTATE</td>\n
<td class=\"rs-h
eaderCell2\">Value</td>\n
</tr>\n
<tr>\n
<td>\n
__VIEWSTATE XML\n
</td>\n
<td>\n
");
[Link](sXmlViewState
);[Link]("\n
</td>\n
</tr>\n </table>
\n
</div>");
};
[Link]("\n");
//------------------------------------------------------------------------------------------------------//Top level Registry KEYS
//------------------------------------------------------------------------------------------------------var RK_HKLM =
"HKEY_LOCAL_MACHINE";
var RK_IPSWITCH =
"Software\\Ipswitch";
var RK_WHATSUP =
RK_IPSWITCH+"\\Network Monitor";
//------------------------------------------------------------------------------------------------------//NmConsole Registry KEYS
//------------------------------------------------------------------------------------------------------var RK_PROFESSIONAL =
RK_WHATSUP+"\\WhatsUp Gold";
var RK_SETTINGS =
RK_PROFESSIONAL+"\\Settings";
var RK_REGIONALSETTINGS =
RK_SETTINGS+"\\Regional Settings";
var RK_SETUP =
RK_PROFESSIONAL+"\\Setup";
//------------------------------------------------------------------------------------------------------//Engine Registry KEYS
//------------------------------------------------------------------------------------------------------var RK_ENGINE =
RK_WHATSUP+"\\WhatsUp Engine";
var RK_WEBSETTINGS =
RK_IPSWITCH+"\\WebServer\\WhatsUp"
var RK_WEBSETTINGS_LDAP =
RK_WEBSETTINGS+"\\LDAP Settings"
var RK_ENGINE_SETTINGS =
RK_ENGINE+"\\Settings";
//------------------------------------------------------------------------------------------------------//Plugins Registry KEYS
//------------------------------------------------------------------------------------------------------var RK_PLUGINS =
RK_WHATSUP+"\\Wh
atsUp Plugins"
var RK_PLUGINS_ACTIVEMONITORS =
RK_PLUGINS+"\\Active Monitors"
var RK_PLUGINS_PASSIVEMONITORS =
RK_PLUGINS+"\\Passive Monitors"
var RK_PLUGINS_PERFORMANCEMONITORS =
RK_PLUGINS+"\\Performance Monitors"
var RK_PLUGINS_ACTIONS =
RK_PLUGINS+"\\Actions"
var RK_PLUGINS_MODEMS =
RK_PLUGINS+"\\Common\\Mo
dems"
var RV_PASSIVEMONITOR_ATTRIBUTES =
"\\Server Configuration\\Attribu
tes";
//------------------------------------------------------------------------------
//--//RK_SETUP
//--var RV_SETUP_1028 = "1028";
var RV_SETUP_INSTALLDIR = "InstallDir";
//--//RK_WEBSETTINGS
//--var RV_WEBSETTINGS_WEBSERVERSSL_ENABLED
var RV_WEBSETTINGS_PORTNUMBER
var RV_WEBSETTINGS_SSLPORTNUMBER
var RV_WEBSETTINGS_SESSIONTIMEOUT
var RV_WEBSETTINGS_USER_GROUP_ACCESS
var RV_WEBSETTINGS_GRAPH_MAP_MAX_WIDTH
var RV_WEBSETTINGS_GRAPH_MAP_MAX_HEIGHT
var RV_WEBSETTINGS_REFRESH
var RV_WEBSETTINGS_SESSIONTIMEOUT_MILLISEC
var RV_WEBSETTINGS_MAX_RECORDS
var RV_WEBSETTINGS_DEMOSERVER_ENABLED
//--//RK_WEBSETTINGS_LDAP
//--var RV_WEBSETTINGS_LDAP_SERVERADDRESS =
var RV_WEBSETTINGS_LDAP_AUTHORIZEDN =
var RV_WEBSETTINGS_LDAP_SECURECONNECTION =
var RV_WEBSETTINGS_LDAP_PORT =
//--//RK_REGIONALSETTINGS
//--var RV_REGIONALSETTINGS_USE24HOURCLOCK =
ck"
var RV_REGIONALSETTINGS_DATETIME12FORMAT =
ormat"
var RV_REGIONALSETTINGS_DATETIME24FORMAT =
ormat"
var RV_REGIONALSETTINGS_DATEFORMAT =
var RV_REGIONALSETTINGS_SHORTDATEFORMAT =
rmat"
"Server Address"
"Authorize DN"
"Secure Connection"
"Port"
"TimeFormat-Use24HourClo
"TimeFormat-DateTime12 F
"TimeFormat-DateTime24 F
"TimeFormat-Date Format"
"TimeFormat-ShortDate Fo
var RV_REGIONALSETTINGS_TIME12FORMAT =
"TimeFormat-Time12 Forma
t"
var RV_REGIONALSETTINGS_TIME24FORMAT =
"TimeFormat-Time24 Forma
t"
var RV_REGIONALSETTINGS_TIME12_SECONDSFORMAT = "TimeFormat-Time12 with Seconds
Format"
var RV_REGIONALSETTINGS_TIME24_SECONDSFORMAT = "TimeFormat-Time24 with Seconds
Format"
var RV_REGIONALSETTINGS_STARTOFWEEK =
"Start of Week";
//--//RK_ALERTCENTER_MESSAGES
//--var RV_ALERTCENTER_MESSAGES_LONG_INCLUDE_ALARMED =
"Include Long Message Currently Alarmed Items";
var RV_ALERTCENTER_MESSAGES_LONG_MAX_ACK =
"Maximum Long Message Acknowledge Items";
var RV_ALERTCENTER_MESSAGES_LONG_MAX_NEW_ALARMED =
"Maximum Long Message New Alarmed Items";
var RV_ALERTCENTER_MESSAGES_LONG_MAX_CURRENT_ALARMED =
ssage Current Alarmed Items";
var RV_ALERTCENTER_MESSAGES_SHORT_INCLUDE_REASON =
"Include Short Message Reason";
var RV_ALERTCENTER_MESSAGES_SHORT_MAX_ACK =
"Maximum Short Message Acknowledge Items";
var RV_ALERTCENTER_MESSAGES_SHORT_MAX_NEW_ALARMED =
"Maximum Short Message New Alarmed Items";
"Maximum Long Me
[Link]("\n");
[Link]("\n");
var INVALID_DATABASEID = 0xFFFFFFFF;
var
var
var
var
var
LOCK_UNSPECIFIED
LOCK_READ_ONLY
LOCK_PESSIMISTIC
LOCK_OPTIMISTIC
LOCK_BATCHOPTIMISTIC
=
=
=
=
=
-1
1;
2
3
4
//
//
//
//
//
adLockUnspecified
adLockReadOnly
adLockPessimistic
adLockOptimistic
adLockBatchOptimistic
}
var oCachedNFDb = null;
function GetCacheNFDb()
{
if(oCachedNFDb==null)
{
oCachedNFDb = GetNFDb();
}
return oCachedNFDb;
}
//
function GetNmSerialize()
{
return [Link]("[Link]");
}
function GetUniqueTempTableName()
{
var sTempTable = "##" + [Link];
sTempTable = [Link](/-/g, "");
return sTempTable;
}
[Link]("\n");
[Link]("\n");
[Link]("\n\n");
// declare translations
var oUserTranslate = GetTranslationObject("[Link]");
[Link]("sExpirationMsg", ""
+ "You are on day %1 of the %2 WhatsUp trial period. The
trial version has expired."
+ "<br>To purchase a license please go to <a href=\"http
://[Link]\">"
+ "[Link]</a>.");
[Link]("sTrialMsg", "You are on day %1 of the %2 What
sUp trial period.");
function GetLicenseManager()
{
var oLicenseManager = Session("LicenseManager");
if(oLicenseManager == null)
{
oLicenseManager = [Link]("[Link]");
Session("LicenseManager") = oLicenseManager;
}
return oLicenseManager;
}
//-->Add new features to the following 3 locations...
// 1) string constant that matches license file
// 2) to oFeatureBitmaskArray with bitmask
// 3) call AddEnabledFeatures() - this will set global bitmask..
var FEATURE_NONE
="None";
var FEATURE_DSTCLIENT
="WUGDstClientEnabled";
var FEATURE_DSTSERVER
="WUGDstServerEnabled";
var
var
var
var
var
var
var
var
FEATURE_SSG
FEATURE_ALERT_CENTER
FEATURE_NETFLOW
FEATURE_DASHBOARD
FEATURE_SQLMON
FEATURE_EXCHANGEMON
FEATURE_WMIMON
FEATURE_EMAILMON
="WUGSSGEnabled";
="WUGAlertCenterEnabled";
="WUGNetflowEnabled";
="WUGDashboardEnabled";
="WUGSQLMonEnabled";
="WUGExchangeMonEnabled";
="WUGWMIMonEnabled";
="WUGEmailMonEnabled";
=0x00000001;
=0x00000002;
=0x00000004;
=0x00000008;
=0x00000010;
=0x00000020;
=0x00000040;
=0x00000080;
=0x00000100;
=0x00000200;
function GetVersionText()
{
var sVersionText = GetWhatsUpEdition() + " Edition " + GetVersionNu
mber();
return sVersionText;
}
//-->Reads Edition from license...
function GetWhatsUpEdition()
{
var oLicenseManager = GetLicenseManager();
var sWhatsUpEdition = [Link]("Edition");
return sWhatsUpEdition;
}
function GetVersionNumber()
{
//--> license file no longer used - now pulling from Reg...
//var oLicenseManager = GetLicenseManager();
//var sWhatsUpVersion = [Link]("Version");
var oReg = [Link]("[Link]");
[Link](RK_SETUP, RK_HKLM);
var sError = [Link]();
if(sError != "")
{
ASSERT("An error occured while attempting to open the registry."
, sError);
}
var sWhatsUpVersion = [Link]("DisplayVersion");
sError = [Link]();
if(sError == "")
{
return sWhatsUpVersion;
}
else
{
return "";
}
}
//-->Reads LicenseType from license...
function GetLicenseKey()
{
var oLicenseManager = GetLicenseManager();
var sLicenseKey = [Link]("LicenseType");
return sLicenseKey;
}
//-->Reads SerialNumber from license...
function GetSerialNumber()
{
var oLicenseManager = GetLicenseManager();
var sSerialNum = [Link]("SerialNumber");
return sSerialNum;
}
//-->Addes dashes (every 5 characters) to SerialNumber...
function GetFormattedSerialNumber()
{
var sSerialNum = GetSerialNumber();
if([Link] > 0)
{
var sTemp = "";
for (var x = 0; x < [Link]; x++)
{
if ((x % 5) == 0 && x != 0)
{
sTemp += "-";
}
sTemp += [Link](x,1);
}
sSerialNum = sTemp;
return sSerialNum;
}
else
{
return null;
}
}
//-->Gets max number of devices from license...
function GetMaximumNumberofDevices()
{
var oLicenseManager = GetLicenseManager();
var nMaxDevices = [Link]("WUGMaxDevices");
return nMaxDevices;
}
//-->Reads Registered FirstName from license...
function GetRegisteredFirstName()
{
var oLicenseManager = GetLicenseManager();
var sFirstName = [Link]("FirstName");
return sFirstName;
}
//-->Reads Registered LastName from license...
function GetRegisteredLastName()
{
var oLicenseManager = GetLicenseManager();
var sLastName = [Link]("LastName");
return sLastName;
}
//-->Calculates days remaining on Eval license...
function GetEvalDaysRemaining()
{
var oLicenseManager = GetLicenseManager();
var nDaysRemaining = [Link] - [Link];
return nDaysRemaining;
}
function IsLicenseRegistered()
{
oLicenseManager = GetLicenseManager();
if([Link] == true)
{
return true;
}
return false;
}
function IsValidLicense()
{
if((IsLicenseRegistered() == true || IsEval() == true) && IsEvalExpired() ==
false && IsSubscriptionExpired() == false)
{
return true;
}
return false;
}
function IsEval()
{
oLicenseManager = GetLicenseManager();
if([Link] == true)
{
return true;
}
return false;
}
function IsEvalExpired()
{
oLicenseManager = GetLicenseManager();
if([Link] && IsEval() == true)
{
return true;
}
return false;
}
function IsSubscriptionExpired()
{
oLicenseManager = GetLicenseManager();
if([Link] && IsSubscription() == true)
{
return true;
}
return false;
}
function GetLicenseExpirationMessage()
{
oLicenseManager = GetLicenseManager();
if(oLicenseManager==null)
{
return null;
}
if([Link])
{
return null;
}
if([Link])
{
<tr>\n
");
}
function GetLicenseExpirationDate()
{
var oLicenseManager = GetLicenseManager();
var sLicenseExpires = [Link]("LicenseExpires");
return sLicenseExpires;
}
function IsSubscription()
{
oLicenseManager = GetLicenseManager();
if([Link] == true)
{
return true;
}
return false;
}
[Link]("\n\n<script>\n
var g_nEnabledFeatureMask = '");
[Link](g_nEnabledFeatureMask
);[Link]("';\n</script>\n<script language=\"JavaScript\" src=\"/NmCo
nsole/CoreNm/Framework/[Link]\"></script>");
[Link]("\n\n");
// standard user constants
var ADMIN_USERID =
1;
var ADMIN_USERNAME =
var GROUPID_MYNETWORK =
var LANGUAGEID_ENGLISH =
"ADMIN";
0;
1033;
=0;
//'
l
//'
//'
//'
var
=2;
//
Authenication types - LDAP and our internal login
var AUTHENTICATIONTYPE_INTERNAL =1;
var AUTHENTICATIONTYPE_LDAP
=2;
// User Rights Bits
var USERRIGHT_ALL
=0xFFFFFFFF;
var USERRIGHT_MANAGEUSERS
001;
var USERRIGHT_CONFIGURELDAPCREDENTIALS
var USERRIGHT_CHANGEYOURPASSWORD
var USERRIGHT_CONFIGUREACTIVEMONITORS
var USERRIGHT_CONFIGUREACTIONS
var USERRIGHT_TRANSLATION
020;
var USERRIGHT_CONFIGUREPASSIVEMONITORS
var USERRIGHT_CONFIGURECREDENTIALS
var USERRIGHT_MANAGEGROUPS
100;
var USERRIGHT_MANAGEDEVICES
200;
var USERRIGHT_ACCESSGROUPANDDEVICEREPORTS
var USERRIGHT_MANAGEIPSECURITY
var USERRIGHT_MANAGEWEBSERVER
var USERRIGHT_ACCESSSYSTEMREPORTS
var USERRIGHT_MANAGERECURRINGACTIONS
var USERRIGHT_CONFIGUREPERFORMANCEMONITORS
var USERRIGHT_MANAGEWORKSPACEVIEWS
var USERRIGHT_CONFIGUREACTIONPOLICIES
var USERRIGHT_ACCESSACTIVEDISCOVERY
var USERRIGHT_CONFIGUREWORKSPACES
var USERRIGHT_ACCESSREMOTEREPORTS
var USERRIGHT_CONFIGUREMIBS
000;
var USERRIGHT_CONFIGUREREMOTESERVERS
var USERRIGHT_ACCESSSSGREPORTS
var USERRIGHT_ACCESSALERTCENTERREPORTS
var USERRIGHT_CONFIGUREALERTCENTER
var USERRIGHT_ACCESSNETFLOWREPORTS
var USERRIGHT_NETFLOWCONFIGURE
//---
=0x00000
=0x00000002;
=0x00000004;
=0x00000008;
=0x00000010;
=0x00000
=0x00000040;
=0x00000080;
=0x00000
=0x00000
=0x00000400;
=0x00000800;
=0x00001000;
=0x00002000;
=0x00004000;
=0x00008000;
=0x00010000;
=0x00020000;
=0x00040000;
=0x00080000;
=0x00100000;
=0x00200
=0x00400000;
=0x00800000;
=0x01000000;
=0x02000000;
=0x04000000;
=0x08000000;
= 120;
="WorkspaceReportRefreshInterval
="FullReportRefreshInter
="DevicesTabRefreshInter
="WebAlarmsRefreshInterv
="ShowBubbleOnWorkspaceReports";
="ShowBubbleOnFullReports";
="DynamicSsgLege
="ShowNetFlowTooltips";
="true";
="true";
="IsDemo
[Link]("\n\n");
// declare translations
var oUserTranslate = GetTranslationObject("[Link]");
[Link]("UserLoginError", "Login failed: %1");
[Link]("DemoUserLoginError", "Login failed: The user
account being logged in is a demo user account and the demo server is currently
disabled.");
[Link]("GetAdminUserLanguageID_Error", "Failed get th
e admin language ID. Error: %1");
[Link]("GetUsersRootDeviceGroupID_Error", "Failed get
the parent group ID. Error: %1");
[Link]("DemoUserRestricted", "This feature is not all
owed for demo users... %1");
[Link]("DemoUserRestrictedJs", "This feature is not a
llowed for demo users...");
[Link]("WebUserTableReadError", "Error occurred readi
ng the WebUser table. SQL error=%1");
[Link]("GetWebUserData_Error", "Failed to do a select
on WebUserData table Error: %1");
[Link]("DemoUserLoginMessage", "You have successfully
logged in as a demo server user. Some features are not fully functional. Click
help for more information.");
[Link]("DemoUserCloseButton", "Close");
[Link]("DemoUserHelpButton", "Help");
//-->Checks for valid product license...
function _CheckProductLicense()
{
// if on the login screen, restriced access screen, invalid license screen,
//
or a valid user id then do check license
var sScriptName = [Link]("SCRIPT_NAME").Item;
if([Link]().indexOf("[Link]") == -1
&& [Link]().indexOf("_demo") == -1
&& [Link]().indexOf("[Link]") ==
-1
)
{
var bIsValidLicense = IsValidLicense();
if(bIsValidLicense == false)
{
//--> Send to help file showing how to enable license...
[Link]("/NmConsole/CoreNm/User/DlgInvalidLicense/D
[Link]");
}
}
}
//--// Checks for browser type (IE 5+, Firefox 1+)
//
and tests for Javascript and Cookies
// The sBtf querystring variable stands for Browser Test Failed
//
the three valid cases are js (javascript), ck (cookie), and bt (
browser type)
//--function _CheckBrowser()
{
// let the webarchive (recurring reports) through
if(IsUserAWebArchive())
{
return;
}
var oBrowserCheckUrl;
try
{
// the url that handles failed browser tests
oBrowserCheckUrl = new CUrl("/NmConsole/CoreNm/User/BrowserCheck
/[Link]");
oInvalidRecuringReportUrl = new CUrl("/NmConsole/CoreNm/User/Inv
alidAddress/[Link]");
}
catch(e)
{
// if the curl include is not included then it is not a normal
// page so forget the browser check
return;
}
// test the browser type and version
var sUserAgent = [Link]("HTTP_USER_AGENT").[Link]
Case();
var bSupportedBrowser = false;
var biPhone = false;
if([Link]("wget") > -1)
{
// let testing scripts through
return;
}
else if([Link]("msie") > -1)
{
var oUserAgentParts = [Link]("msie ");
+
+
+
+
?sBtf=ck\";"
+ "}"
+ "</script>");
}
}
var _oUserRights = new Array();
function _AddUserRight(nUserRight, sEnglishName, sCategory, sFeature)
{
// note: this translation is ok since all rights are translated at once
var oRegEx = new RegExp("(\\s+)","g");
var sControlName = "UserRight_" + [Link](oRegEx, "");
var sTranslatedName = [Link](sControlName, sEnglishNam
e);
var sCategoryControlName = "UserRightCategory_" + [Link](oReg
Ex, "");
var sTranslatedCategory = [Link](sCategoryControlName,
sCategory);
// if the feature is not enabled then do not add the right
if(IsFeatureEnabled(sFeature)==false)
{
return;
}
var oUserRight = new Object();
oUserRight.m_nUserRight = nUserRight;
oUserRight.m_sEnglishName = sEnglishName;
oUserRight.m_sTranslatedName = sTranslatedName;
oUserRight.m_sCagetory = sTranslatedCategory;
oUserRight.m_sFeature = sFeature;
_oUserRights.push(oUserRight);
}
// Gets the user right mask for the current user
function _GetUserRightsMask()
{
// If the user is a webarchive then return just report access rights
if(IsUserAWebArchive())
{
return USERRIGHT_ACCESSGROUPANDDEVICEREPORTS | USERRIGHT_ACCESSS
YSTEMREPORTS | USERRIGHT_ACCESSREMOTEREPORTS;
}
// if there is no right (user not logged in?) then return 0 "no rights"
else if(Session("nUserRightsMask") == null)
{
return 0;
}
// return the current users rights from the session
else
{
return parseInt(Session("nUserRightsMask"));
}
}
//--// Get the user home group id... this could return null
//
if the user does not have a home group and we do not want to return
//
0 because this could cause an access violation
//--function _GetUsersHomeDeviceGroupID(nWebUserID)
{
if(nWebUserID == null)
{
ASSERT("The user id is required.");
}
var sSql = ""
+ "SELECT "
+ "
ISNULL(nHomeDeviceGroupID, 0) AS nHomeDeviceGroupID "
+ "FROM WebUser "
+ "WHERE nWebUserID = " + nWebUserID;
var oDb = GetDb();
var oResult = [Link](sSql);
if ([Link])
{
var sTranslatedError = [Link]("WebUserTableR
eadError", [Link]);
[Link](sTranslatedError);
return null;
}
if([Link])
{
return null;
}
var nHomeDeviceGroupID = [Link]("nHomeDeviceGroupID");
[Link];
return nHomeDeviceGroupID;
}
//--// Attempts to login the user using sUserName and sPassword supplied
// by the query string (this is picked up by aspForms
//--function _AutomaticLogin()
{
// if there is a username on the querystring and it is not the
// current user signed in (or there is no user signed in
// then attempt the automatic login
var sUserName = [Link]("sUserName");
var sPassword = [Link]("sPassword");
if(sUserName != null &&
sUserName != GetUserName()
&& [Link]("SCRIPT_NAME").[Link]().ind
exOf("[Link]") == -1
&& [Link]("SCRIPT_NAME").[Link]().ind
exOf("_demo") == -1)
{
// make sure all sensitive session data is cleared
// by calling logout
UserLogout();
// if UserLogin fails it will send the appropriate message to th
e user
var bLoginSuccess = UserLogin(sUserName, sPassword);
if(bLoginSuccess)
{
// remove the username and password and redirect
[Link](GetScriptNameUrl().AsString());
}
}
else if(sUserName != null && sUserName == GetUserName()&& [Link]
Variables("SCRIPT_NAME").[Link]().indexOf("[Link]") == -1
&& [Link]("SCRIPT_NAME").[Link]().ind
exOf("_demo") == -1)
{
//--> if sUserName is same as sUserName in session - strip user & pa
ss from url and redirect...
[Link](GetScriptNameUrl().AsString());
}
}
// get current page url, add querystring items, remove username and password (if
applicable)
function GetScriptNameUrl()
{
var oRedirectUrl = new CUrl(String([Link]("SCRIPT_NAME")));
var oEnum = new Enumerator([Link]);
while(![Link]())
{
var sItemName = [Link]();
var sItemValue = String([Link](sItemName));
[Link](sItemName, sItemValue);
[Link]();
}
[Link]("sUserName");
[Link]("sPassword");
return oRedirectUrl;
}
//--// Retrieves the group access rights for the specified group
// these rights are stored off in the session until the user logs off
//--function _GetUserGroupRights(nDeviceGroupID)
{
var oRights = new Array();
var oUserGroupAccess = Session("USER_GROUP_ACCESS_" + GetUserIDForGroupA
ccess());
if(oUserGroupAccess == null)
{
oUserGroupAccess = [Link]("[Link]");
}
// If the rights for the group have already been read, then get them fro
m the session
if([Link](nDeviceGroupID))
{
oRights = [Link](nDeviceGroupID).split(",");
}
else
{
var sSql = ""
+ "SELECT "
+ "
bGroupRead, bGroupWrite, bDeviceRead, bDeviceWri
te, [Link] "
+ "FROM DeviceGroup "
+ "
LEFT OUTER JOIN PivotWebUserToDeviceGroup "
+ "
ON [Link] = PivotWeb
[Link] "
+ "
AND [Link]
= " + GetUserIDForGroupAccess() + " "
+ "WHERE [Link] = " + nDeviceGroupID
;
var oDb = GetDb();
var oResult = [Link](sSql);
if([Link])
{
ASSERT("The database object failed to initialize." + oRe
[Link]);
}
// if there is no record then the user has no access
if([Link])
{
oRights = [0, 0, 0, 0];
}
else
{
// set each access right
if([Link]("bGroupRead") == true || [Link]
eldAsBool("bDynamicGroup") == true)
{
oRights[GROUP_READ] = 1;
}
else
{
oRights[GROUP_READ] = 0;
}
if([Link]("bGroupWrite") == true)
{
oRights[GROUP_WRITE] = 1;
}
else
{
oRights[GROUP_WRITE] = 0;
}
if([Link]("bDeviceRead") == true)
{
oRights[DEVICE_READ] = 1;
}
else
{
oRights[DEVICE_READ] = 0;
}
if([Link]("bDeviceWrite") == true)
{
oRights[DEVICE_WRITE] = 1;
}
else
{
oRights[DEVICE_WRITE] = 0;
}
}
// Add the rights to the session
[Link](nDeviceGroupID, [Link](","));
Session("USER_GROUP_ACCESS_" + GetUserIDForGroupAccess()) = oUse
rGroupAccess;
}
return oRights;
}
//--// Retrieves the device access rights for the specified device
// these rights are stored off in the session until the user logs off
//--function _GetUserDeviceRights(nDeviceID)
{
var oRights = new Array();
var oUserDeviceAccess = Session("USER_DEVICE_ACCESS_" + GetUserIDForGrou
pAccess());
if(oUserDeviceAccess == null)
{
oUserDeviceAccess = [Link]("[Link]");
}
// If the rights for the device have already been read, then get them fr
om the session
if([Link](nDeviceID))
{
oRights = [Link](nDeviceID).split(",");
}
else
{
var sSql = ""
+ "SELECT SUM(CONVERT(TINYINT, PivotWebUserToDeviceGroup
.bDeviceRead)) AS bDeviceRead, "
+ "
SUM(CONVERT(TINYINT, PivotWebUserToDeviceGroup.b
DeviceWrite)) AS bDeviceWrite "
+ "FROM DeviceGroup "
+ "
INNER JOIN PivotDeviceToGroup ON "
+ "
[Link] = Devi
[Link] "
+ " INNER JOIN Device ON "
+ "
[Link] = [Link]
eviceID "
+ "
INNER JOIN PivotWebUserToDeviceGroup ON "
+ "
[Link]
= [Link] "
+ "WHERE [Link] = " + nDeviceID
+ "
AND [Link] = " + G
etUserIDForGroupAccess();
var oDb = GetDb();
var oResult = [Link](sSql);
if ([Link])
{
ASSERT("The database object failed to initialize." + oRe
[Link]);
}
// if there is no record then the user has no access
if([Link])
{
oRights = [0, 0];
}
else
{
// set each access right
if([Link]("bDeviceRead") == true)
{
oRights[DEVICE_READ] = 1;
}
else
{
oRights[DEVICE_READ] = 0;
}
if( [Link]("bDeviceWrite") == true)
{
oRights[DEVICE_WRITE] = 1;
}
else
{
oRights[DEVICE_WRITE] = 0;
}
}
// Add the rights to the session
[Link](nDeviceID, [Link](","));
Session("USER_DEVICE_ACCESS_" + GetUserIDForGroupAccess()) = oUs
erDeviceAccess;
}
return oRights;
}
//-// Sets the registry value which enables or disables the access rights
//-function _SetUserGroupAccess(bIsEnabled)
{
if(IsUserDemoUser())
{
return;
}
// Convert bIsEnabled to a number if it is not one already
var nIsEnabled = 0;
if(isNaN(parseInt(bIsEnabled)))
{
if(bIsEnabled == true)
{
nIsEnabled = 1;
}
else
{
nIsEnabled = 0;
}
}
else
{
nIsEnabled = bIsEnabled;
}
var oReg = [Link]("[Link]");
[Link](RK_WEBSETTINGS, RK_HKLM);
var sError = [Link]();
if(sError != "")
{
ASSERT("An error occured while attempting to open the registry."
, sError);
}
// Set the value
[Link](RV_WEBSETTINGS_USER_GROUP_ACCESS, nIsEnabled);
sError = [Link]();
if(sError != "")
{
ASSERT("An error occured while attempting to set the registry va
lue : " + RV_WEBSETTINGS_USER_GROUP_ACCESS, sError);
}
// store the value in the session
Session(RV_WEBSETTINGS_USER_GROUP_ACCESS) = nIsEnabled;
}
//-// Returns true if the registry value which enables the access rights is 1, othe
rwise false
//-function _IsUserGroupAccessEnabled()
{
// try to get the value from the session
var nIsEnabled = Session(RV_WEBSETTINGS_USER_GROUP_ACCESS);
// if the value was not in the session, read from the registry
if(nIsEnabled == null)
{
var oReg = [Link]("[Link]");
[Link](RK_WEBSETTINGS, RK_HKLM);
var sError = [Link]();
if(sError != "")
{
ASSERT("An error occured while attempting to open the re
gistry.", sError);
}
nIsEnabled = [Link](RV_WEBSETTINGS_USER_GROUP_ACCESS);
sError = [Link]();
if(sError != "")
{
// create the reg key - this will also assert if any err
ors occures in the creation
_SetUserGroupAccess(false);
nIsEnabled = 0;
}
}
// return true or false, not 0 or 1
if(nIsEnabled == 0)
{
return false;
}
else
{
return true;
}
}
// makes the users configure rights available to the client for
// building the dynamic configure menu
function _WriteConfigureMenuAccessRights()
{
var oUsersConfigureRights = new Array();
if(UserHasRight(USERRIGHT_CONFIGUREPERFORMANCEMONITORS))
{
[Link]("Performance Monitor Library");
}
if(UserHasRight(USERRIGHT_CONFIGUREACTIVEMONITORS))
{
[Link]("Active Monitor Library");
}
if(UserHasRight(USERRIGHT_CONFIGUREPASSIVEMONITORS))
{
[Link]("Passive Monitor Library");
}
if(UserHasRight(USERRIGHT_CONFIGUREACTIONS))
{
[Link]("Action Library");
}
if(UserHasRight(USERRIGHT_CONFIGUREACTIONPOLICIES))
{
[Link]("Action Policies");
}
if(UserHasRight(USERRIGHT_CONFIGURECREDENTIALS))
{
[Link]("Credentials Library");
}
if(UserHasRight(USERRIGHT_MANAGEWORKSPACEVIEWS))
{
[Link]("Workspace Library");
}
if(UserHasRight(USERRIGHT_CONFIGUREREMOTESERVERS) && IsFeatureEnabled(FE
ATURE_DSTSERVER) == true)
{
[Link]("Remote Sites");
}
if(UserHasRight(USERRIGHT_MANAGERECURRINGACTIONS))
{
[Link]("Recurring Actions");
}
if(UserHasRight(USERRIGHT_MANAGEWEBSERVER))
{
[Link]("Manage Web Server");
}
if(UserHasRight(USERRIGHT_MANAGEUSERS))
{
[Link]("Manage Users");
}
if(UserHasRight(USERRIGHT_CONFIGUREMIBS))
{
[Link]("Manage SNMP MIBs");
}
if(UserHasRight(USERRIGHT_CONFIGURELDAPCREDENTIALS))
{
[Link]("LDAP Credentials");
}
if(UserHasRight(USERRIGHT_MANAGEIPSECURITY))
{
[Link]("IP Security");
}
if(UserHasRight(USERRIGHT_TRANSLATION))
{
[Link]("Translation");
}
if(UserHasRight(USERRIGHT_CONFIGUREALERTCENTER))
{
[Link]("AlertCenterConfigure");
}
if(UserHasRight(USERRIGHT_NETFLOWCONFIGURE))
{
[Link]("NetflowConfigure");
}
[Link]("\n <script>\n
var sUsersConfigureRights = \"");
[Link]([Link](",")
);[Link]("\";\n
</script>\n
");
}
// Loads all the webuserdata for the current user if not already loaded
// this is stored in the session to save a database lookup on every page
// then returns the the value associated with sName
function _GetWebUserData(sName)
{
var sWebUserData = Session("WebUserData");
if(sWebUserData == null)
{
var sWebUserData = "";
var oDb = GetDb();
var sSql = "SELECT sName, sValue FROM WebUserData WHERE nWebUser
ID = " + GetUserID();
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("GetW
ebUserData_Error", [Link]);
[Link](sTranlsationError);
return null;
}
while(![Link])
{
sWebUserData += [Link]("sName") + "," + oD
[Link]("sValue") + "|";
[Link]();
}
Session("WebUserData") = sWebUserData;
}
var oWebUserData = [Link]("|");
for(var i = 0; i < [Link]; i++)
{
var oData = oWebUserData[i].split(",");
if(oData[0] == sName)
{
return oData[1];
}
}
return null;
}
// checks the registry to see if the demo server is enabled
var g_IsDemoServerEnabled = null;
function IsDemoServerEnabled()
{
if(g_IsDemoServerEnabled != null)
{
return g_IsDemoServerEnabled;
}
var oReg = [Link]("[Link]");
[Link](RK_WEBSETTINGS, RK_HKLM);
var sError = [Link]();
if(sError != "")
{
[Link]("An error occured while attempting to open the
registry.\n" + sError);
return false;
}
var nIsDemoServerEnabled = [Link](RV_WEBSETTINGS_DEMOSERVER_ENABL
ED);
sError = [Link]();
if(sError != "")
{
[Link](RV_WEBSETTINGS_DEMOSERVER_ENABLED, 0);
nIsDemoServerEnabled = 0;
sError = [Link]();
}
if(sError != "")
{
ASSERT("An error occured while attempting to read the registry."
, sError);
}
if(nIsDemoServerEnabled == 1)
{
g_IsDemoServerEnabled = true;
}
else
{
g_IsDemoServerEnabled = false;
}
return g_IsDemoServerEnabled;
}
function _ShowDemoUserMessage()
{
var bShowDemoUserMessage = Session("bShowDemoUserMessage");
if(null==bShowDemoUserMessage || false==bShowDemoUserMessage)
{
return;
}
var sMessage = [Link]("DemoUserLoginMessage");
var sCloseButton = "<a href=\"javascript:CloseDemoUserMessage();\" style
=\"text-decoration:underline;\">" + [Link]("DemoUserCloseBut
ton") + "</a>";
var sHelpButton = "<a href=\"javascript:[Link](HELP_DEMO
SERVER_URL);\" style=\"text-decoration:underline;\">" + [Link]
Ex("DemoUserHelpButton") + "</a>";
[Link]("\n <div id=\"oDemoUserMessage\" style=\"position:absolute;t
op:0;border:2px outset;background:#ECE9D8;padding:10px;width:300px;\" class=\"As
pf-Font\">\n
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n
<tr>\n
<td>");
[Link](sMessage
);[Link]([Link]()
);[Link]("</td>\n
</tr>\n
<tr>\n
<td align=\"right\">\n
");
[Link](sHelpButton
);[Link](" | ");
[Link](sCloseButton
);[Link]("\n
</td>\n
</tr>\n </table>
\n
</div>\n
<script>\n
JsCenterDiv([Link](\"oD
emoUserMessage\"));\n function CloseDemoUserMessage()\n
{\n
[Link](\"oDemoUserMessage\").[Link] = \"none\";\n
}\n
</script>\n
");
Session("bShowDemoUserMessage") = false;
}
[Link]("\n");
//-// Helper functions for the user activity log
//-//
//
//
var
var
var
var
var
var
var
var
Categories
BULK_FIELD_CHANGE = "Bulk Field Change";
DEVICE_DETAILS
= "Device Properties";
DEVICES
= "Devices";
ACTIVE_MONITOR
= "Active Monitor";
PASSIVE_MONITOR
= "Passive Monitor";
PERFORMANCE_MONITOR = "Performance Monitor";
CREDENTIALS
= "Credentials";
ACTION_POLICY
= "Action Policy";
var
var
var
var
var
var
var
RECURRING_ACTION
LOGIN
ACTION
USER
WORKSPACE
SYSTEM
REMOTE_SITE
= "Recurring Action";
= "Login";
= "Action";
= "User";
= "Workspace";
= "System";
= "Remote Site";
// declare translations
var oUserTranslate = GetTranslationObject("[Link]");
[Link]("AnonymousUserName", "Anonymous");
[Link]("_LogUserMessage_Error", "Failed to add the we
b user activity log record. Error: %1");
[Link]("_GetDeviceDisplayNameForLog_Error", "Failed t
o get the device display name. Error: %1");
[Link]("_GetMultipleDeviceDisplayNamesForLog_Error",
"Failed to get multiple device display names. Error: %1");
[Link]("GetDeviceGroupDisplayNameForLog_Error", "Fail
ed to get the device group display name. Error: %1");
[Link]("_GetCredentialTypeNameForLog_Error", "Failed
to get the credential type name. Error: %1");
[Link]("_GetActiveMonitorTypeNameForLog_Error", "Fail
ed to get the active monitor type name. Error: %1");
[Link]("_GetWebUserNameForLog_Error", "Failed to get
the web user name. Error: %1");
[Link]("_GetActionPolicyNameForLog_Error", "Failed to
get the action type name. Error: %1");
[Link]("_GetActionTypeNameForLog_Error", "Failed to g
et the action type name. Error: %1");
[Link]("_GetActiveMonitorTypeNameForLogFromPivot_Erro
r", "Failed to get the monitor type name from pivot id. Error: %1");
[Link]("_GetPassiveMonitorTypeNameFromPivotForLog_Err
or", "Failed to get the passive monitor type name from pivot id. Error: %1");
[Link]("_GetPerfromanceMonitorTypeNameForLog_Error",
"Failed to get the performance monitor type name. Error: %1");
[Link]("_GetPassiveMonitorTypeNameForLog_Error", "Fai
led to get the passive monitor type name. Error: %1");
[Link]("_GetRecurringActionNameForLog_Error", "Failed
to get the recurring action name. Error: %1");
[Link]("_GetWorkspaceNameForLog_Error", "Failed to ge
t the workspace name. Error: %1");
[Link]("_GetDeviceDisplayNameFromWebAlarmIDForLog_Err
or", "Failed to get device display name from web alarm id. Error: %1");
[Link]("_GetDevDisNameFromActDiscDevIDForLog", "Faile
d to get device display name from active discovery device detail id. Error: %1")
;
[Link]("_GetActMonTypeNameFromActDiscServIDForLog_Err
or", "Failed to get monitorname from active discovery service detail id. Error:
%1");
[Link]("_GetStatMonNameActDiscStatMonIDLog_Error", "F
ailed to get monitor name from active discovery performance monitor detail id. E
rror: %1");
[Link]("_GetRemoteServerDisplayNameForLog_Error", "Fa
iled to get the remote site display name. Error: %1");
// translate the logging categories
var oUserTranslateForAdmin = GetTranslationObjectForAdminUser();
_DeclareTranslatedCategory(BULK_FIELD_CHANGE);
_DeclareTranslatedCategory(DEVICE_DETAILS);
_DeclareTranslatedCategory(DEVICES);
_DeclareTranslatedCategory(ACTIVE_MONITOR);
_DeclareTranslatedCategory(PASSIVE_MONITOR);
_DeclareTranslatedCategory(PERFORMANCE_MONITOR);
_DeclareTranslatedCategory(CREDENTIALS);
_DeclareTranslatedCategory(ACTION_POLICY);
_DeclareTranslatedCategory(RECURRING_ACTION);
_DeclareTranslatedCategory(LOGIN);
_DeclareTranslatedCategory(ACTION);
_DeclareTranslatedCategory(USER);
_DeclareTranslatedCategory(WORKSPACE);
_DeclareTranslatedCategory(SYSTEM);
_DeclareTranslatedCategory(REMOTE_SITE);
// translate the log messages
[Link]("LogCreateDevice_Message", "Added devi
ce '%1'");
[Link]("LogMoveDevice_Message", "Moved device
'%1' from the '%2' group to the '%3' group");
[Link]("LogCopyDevice_Message", "Copied devic
e '%1' to the '%2' group");
[Link]("LogUpdateGeneralDevice_Message", "Mod
ified general device properties of '%1'");
[Link]("LogModifiedDeviceCredentials_Message"
, "Modified credentials on '%1'");
[Link]("LogModifiedDevicePolling_Message", "M
odified polling properties on '%1'");
[Link]("LogDevicePassiveMonitorProperties_Mes
sage", "%1 the '%2' passive monitor on '%3'");
[Link]("LogModifiedDeviceActiveMonitor_Messag
e", "Modified active monitor on '%1'");
[Link]("LogDeviceActiveMonitorProperties_Mess
age", "%1 the '%2' active monitor on '%3'");
[Link]("LogDevicePerformanceMonitorProperties
_Message", "%1 the '%2' performance monitor on '%3'");
[Link]("LogModifiedDeviceNotes_Message", "Mod
ified notes on '%1'");
[Link]("LogModifiedDeviceCustomLinks_Message"
, "Modified custom links on '%1'");
[Link]("LogModifiedDeviceAttributes_Message",
"Modified attributes on '%1'");
[Link]("LogDeletedDevice_Message", "Deleted d
evice '%1'");
[Link]("LogAcknowledgeDevice_Message", "Ackno
wledged '%1'");
[Link]("LogModifiedDeviceAction_Message", "Mo
dified actions on '%1'");
[Link]("LogBFCDevicePerformanceMonitor_Messag
e", "Performance monitor bulk field changes on '%1'");
[Link]("LogBFCDeviceAttributes_Message", "Att
ribute bulk field changes on '%1'");
[Link]("LogBFCDeviceNotes_Message", "Note bul
k field changes on '%1'");
[Link]("LogBFCActiveMonitorType_Message", "Ac
tive Monitor type bulk field changes on '%1'");
[Link]("LogBFCDeviceCredentials_Message", "Cr
edential bulk field changes on '%1'");
[Link]("LogBFCDeviceActionPolicy_Message", "A
ction Policy bulk field changes on '%1'");
[Link]("LogBFCDeviceMaintenance_Message", "Ma
{
var oDb = GetCacheDb();
var sSql = "SELECT sDisplayName FROM Device WHERE nDeviceID = " + nDevic
eID;
var oResult = [Link](sSql);
if([Link])
{
var sTranlsationError = [Link]("_GetDeviceDi
splayNameForLog_Error", [Link]);
[Link](sTranlsationError);
return "unknown";
}
var sDisplayName = "";
if(![Link])
{
sDisplayName = [Link]("sDisplayName");
}
return sDisplayName;
}
// Gets a comma seperated string of device display names
// given an array of device ids
function _GetMultipleDeviceDisplayNamesForLog(oDeviceIDs)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SELECT TOP 20 sDisplayName "
+ "FROM Device "
+ "WHERE nDeviceID IN (" + [Link]() + ")";
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("_GetMultiple
DeviceDisplayNamesForLog_Error", [Link]);
[Link](sTranlsationError);
return false;
}
var sDisplayNames = "";
while(![Link])
{
sDisplayNames += [Link]("sDisplayName");
[Link]();
}
if([Link]([Link] - 2) == ",")
{
sDisplayNames = [Link](0, [Link]
- 2);
}
return sDisplayNames;
}
// Gets the group display name
function GetDeviceGroupDisplayNameForLog(nDeviceGroupID)
{
var oDb = GetCacheDb();
var sSql = "SELECT sGroupName FROM DeviceGroup WHERE nDeviceGroupID = "
+ nDeviceGroupID;
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("GetDeviceGro
upDisplayNameForLog_Error", [Link]);
[Link](sTranlsationError);
return false;
}
var sGroupName = "";
if(![Link])
{
sGroupName = [Link]("sGroupName");
}
return sGroupName;
}
// Gets the credential type name
function _GetCredentialTypeNameForLog(nCredentialTypeID)
{
var oDb = GetCacheDb();
var sSql = "SELECT sDisplayName FROM CredentialType WHERE nCredentialTyp
eID = " + nCredentialTypeID;
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("_GetCredenti
alTypeNameForLog_Error", [Link]);
[Link](sTranlsationError);
return false;
}
var sDisplayName = "";
if(![Link])
{
sDisplayName = [Link]("sDisplayName");
}
return sDisplayName;
}
// Gets the active monitor type name
function _GetActiveMonitorTypeNameForLog(nActiveMonitorTypeID)
{
var oDb = GetCacheDb();
var sSql = "SELECT sMonitorTypeName FROM ActiveMonitorType WHERE nActive
MonitorTypeID = " + nActiveMonitorTypeID;
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("_GetActiveMo
nitorTypeNameForLog_Error", [Link]);
[Link](sTranlsationError);
return false;
}
var sMonitorTypeName = "";
if(![Link])
{
sMonitorTypeName = [Link]("sMonitorTypeName");
}
return sMonitorTypeName;
}
// Gets the user name
function _GetWebUserNameForLog(nWebUserID)
{
var oDb = GetCacheDb();
var sSql = "SELECT sUserName FROM WebUser WHERE nWebUserID = " + nWebUse
rID;
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("_GetWebUserN
ameForLog_Error", [Link]);
[Link](sTranlsationError);
return false;
}
var sUserName = "";
if(![Link])
{
sUserName = [Link]("sUserName");
}
return sUserName;
}
//
Gets the action policy name
function _GetActionPolicyNameForLog(nActionPolicyID)
{
var oDb = GetCacheDb();
var sSql =
"SELECT nActionPolicyID, " +
"
sPolicyName " +
"FROM ActionPolicy " +
"WHERE nActionPolicyID = " + nActionPolicyID;
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("_GetActionPo
licyNameForLog_Error", [Link]);
[Link](sTranlsationError);
return false;
}
var sActionPolicyName = "";
if(![Link])
{
sActionPolicyName = [Link]("sPolicyName");
}
return sActionPolicyName;
}
// Gets the action type name
function _GetActionTypeNameForLog(nActionTypeID)
{
var oDb = GetCacheDb();
var sSql = "SELECT sActionTypeName FROM ActionType WHERE nActionTypeID =
" + nActionTypeID;
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("_GetActionTy
peNameForLog_Error", [Link]);
[Link](sTranlsationError);
return false;
}
var sActionTypeName = "";
if(![Link])
{
sActionTypeName = [Link]("sActionTypeName");
}
return sActionTypeName;
}
// Gets the active monitor type name
function _GetActiveMonitorTypeNameForLogFromPivot(nPivotActiveMonitorTypeToDevic
eID)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SELECT sMonitorTypeName "
+ "FROM PivotActiveMonitorTypeToDevice "
+ "INNER JOIN ActiveMonitorType ON [Link]
torTypeID=[Link] "
+ "WHERE nPivotActiveMonitorTypeToDeviceID = " + nPivotActiveMon
itorTypeToDeviceID;
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("_GetActiveMo
nitorTypeNameForLogFromPivot_Error", [Link]);
[Link](sTranlsationError);
return false;
}
var sMonitorTypeName = "";
if(![Link])
{
sMonitorTypeName = [Link]("sMonitorTypeName");
}
return sMonitorTypeName;
}
// Gets the passive monitor type name given the pivot id
function _GetPassiveMonitorTypeNameFromPivotForLog(nPivotPassiveMonitorTypeToDev
iceID)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SELECT sMonitorTypeName, nCLSID "
+ "FROM PivotPassiveMonitorTypeToDevice "
+ "INNER JOIN PassiveMonitorType ON [Link]
onitorTypeID=[Link] "
+ "WHERE nPivotPassiveMonitorTypeToDeviceID = " + nPivotPassiveM
onitorTypeToDeviceID;
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("_GetPassiveM
onitorTypeNameFromPivotForLog_Error", [Link]);
[Link](sTranlsationError);
return false;
}
var sMonName = "";
if(![Link])
{
var nCLSID = [Link]("nCLSID");
var sMonName = [Link]("sMonitorTypeName");
splayNameFromWebAlarmIDForLog_Error", [Link]);
[Link](sTranlsationError);
return false;
}
var sDisplayName = "";
if(![Link])
{
sDisplayName = [Link]("sDisplayName");
}
return sDisplayName;
}
//
Gets the device display name from the ActiveDiscoveryResultDeviceDetail
function _GetDeviceDisplayNameFromActiveDiscoveryDeviceIDForLog(nActiveDiscovery
ResultDeviceDetailID)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SELECT sHostName "
+ "FROM ActiveDiscoveryResultDeviceDetail "
+ "WHERE nActiveDiscoveryResultDeviceDetailID = "
+ nActiveDiscoveryResultDeviceDetailID;
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("_GetDevDisNa
meFromActDiscDevIDForLog", [Link]);
[Link](sTranlsationError);
return false;
}
var sDisplayName = "";
if(![Link])
{
sDisplayName = [Link]("sHostName");
}
return sDisplayName;
}
//
Gets the monitor name from ActiveDiscoveryResultServiceDetails table
function _GetActiveMonitorTypeNameFromActiveDiscoveryServiceIDForLog(nActiveDisc
overyResultServiceDetailID)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SELECT sDescription "
+ "FROM ActiveDiscoveryResultServiceDetail "
+ "WHERE nActiveDiscoveryResultServiceDetailID = "
+ nActiveDiscoveryResultServiceDetailID;
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("_GetActMonTy
peNameFromActDiscServIDForLog_Error", [Link]);
[Link](sTranlsationError);
return false;
}
var sMonitorName = "";
if(![Link])
{
sMonitorName = [Link]("sDescription");
}
return sMonitorName;
}
//
Gets the performance monitor name from the ActiveDiscoveryResultStatisti
calMonitorDetails table
function _GetStatisticalMonitorTypeNameFromActiveDiscoveryStatisticalMonitorIDFo
rLog(nActiveDiscoveryResultStatisticalMonitorDetailID)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SELECT sDescription "
+ "FROM ActiveDiscoveryResultStatisticalMonitorDetails "
+ "WHERE nActiveDiscoveryResultStatisticalMonitorDetailID = "
+ nActiveDiscoveryResultStatisticalMonitorDetailID;
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("_GetStatMonN
ameActDiscStatMonIDLog_Error", [Link]);
[Link](sTranlsationError);
return false;
}
var sMonitorName = "";
if(![Link])
{
sMonitorName = [Link]("sDescription");
}
return sMonitorName;
}
// Gets the passive monitor server name
function _GetPassiveMonitorServerNameForLog(sDescription)
{
var sName = "Could not determine class name.";
var oReg = [Link]("[Link]");
[Link](RK_PLUGINS_PASSIVEMONITORS, RK_HKLM);
var sError = [Link]();
if(sError != "")
{
// not manditory so no need to fail
return sName
}
var oKeys = [Link]().toArray();
for(ii = 0; ii < [Link]; ii++)
{
[Link](sKey+"\\"+oKeys[ii], RK_HKLM);
if([Link]("CLSID").toString() == sCLSID)
{
sName = [Link]("DisplayName").toString();
break;
}
}
return sName;
}
iption);
}
function LogModifiedDevicePolling(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogModifiedDevice
Polling_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption);
}
function LogDevicePassiveMonitorModification(nDeviceID, sPassiveMonitor, sModifi
cation,sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogDevicePassiveM
onitorProperties_Message", sModification, sPassiveMonitor,sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption);
}
function LogModifiedDeviceActiveMonitor(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogModifiedDevice
ActiveMonitor_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption);
}
function LogDeviceActiveMonitorModification(nDeviceID, sActiveMonitor, sModifica
tion,sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogDeviceActiveMo
nitorProperties_Message", sModification, sActiveMonitor,sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption);
}
function LogDevicePerformanceMonitorModification(nDeviceID, sPerformanceMonitor,
sModification,sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogDevicePerforma
nceMonitorProperties_Message", sModification, sPerformanceMonitor,sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption);
}
function LogModifiedDeviceNotes(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogModifiedDevice
Notes_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption)
}
function LogModifiedDeviceCustomLinks(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogModifiedDevice
CustomLinks_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption)
}
function LogModifiedDeviceAttributes(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogModifiedDevice
Attributes_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption)
}
function LogDeletedDevice(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogDeletedDevice_
Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
function LogAcknowledgeDevice(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogAcknowledgeDev
ice_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
function LogModifiedDeviceAction(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogModifiedDevice
Action_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption);
}
//--// BFC logging
//--function LogBFCDevicePerformanceMonitor(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogBFCDevicePerfo
rmanceMonitor_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCDeviceAttributes(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogBFCDeviceAttri
butes_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription)
}
enance_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCDeviceMaintenanceSchedule(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogBFCDeviceMaint
enanceSchedule_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCDevicePolling(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogBFCDevicePolli
ng_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCDeviceDeviceType(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogBFCDeviceDevic
eType_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription)
}
function LogBFCDeviceActiveMonitorProperties(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogBFCDeviceActiv
eMonitorProperties_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCDeviceDependencies(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogBFCDeviceDepen
dencies_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCDevicePassiveMonitorType(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogBFCDevicePassi
veMonitorProperties_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCPassiveMonitorProperties(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = [Link]("LogBFCDevicePassi
veMonitorActions_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
//--// Group logging
//--function LogCreateGroup(nDeviceGroupID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = GetDeviceGroupDisplayNameForLog(nDeviceGroupID);
}
var sDescription = [Link]("LogCreateGroup_Me
ssage", sDisplayName);
var sDetails = "nDeviceGroupID=" + nDeviceGroupID
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
function LogModifiedGroup(nDeviceGroupID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = GetDeviceGroupDisplayNameForLog(nDeviceGroupID);
}
var sDescription = [Link]("LogModifiedGroup_
Message", sDisplayName);
var sDetails = "nDeviceGroupID=" + nDeviceGroupID
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
function LogDeletedGroup(nDeviceGroupID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = GetDeviceGroupDisplayNameForLog(nDeviceGroupID);
}
var sDescription = [Link]("LogDeletedGroup_M
essage", sDisplayName);
var sDetails = "nDeviceGroupID=" + nDeviceGroupID
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
//
Log the group move
function LogMovedGroup( nDeviceGroupID, nDestinationGroupID)
{
var sGroupName
= GetDeviceGroupDisplayNameForLo
g(nDeviceGroupID);
var sDestinationGroupName
= GetDeviceGroupDisplayNameForLog(nDesti
nationGroupID);
var sDescription = [Link]("LogMovedGroup_Mes
sage", sGroupName,sDestinationGroupName);
var sDetails = "nDeviceGroupID=" + nDeviceGroupID
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
//
Log the group copy
function LogCopyGroup( nDeviceGroupID, nDestinationGroupID)
{
var sGroupName
= GetDeviceGroupDisplayNameForLo
g(nDeviceGroupID);
var sDestinationGroupName
= GetDeviceGroupDisplayNameForLog(nDesti
nationGroupID);
var sDescription = [Link]("LogCopyGroup_Mess
age", sGroupName,sDestinationGroupName);
var sDetails = "nDeviceGroupID=" + nDeviceGroupID
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
//--//
Active Discovery logging
//--function LogAddActiveDiscoveryDevice(nDeviceGroupID, nActiveDiscoveryResultDevic
eDetailID,sGroupDisplayName, sDeviceDisplayName)
{
if(sGroupDisplayName == null)
{
sGroupDisplayName = GetDeviceGroupDisplayNameForLog(nDeviceGroup
ID);
}
if(sDeviceDisplayName == null)
{
sDeviceDisplayName = _GetDeviceDisplayNameFromActiveDiscoveryDev
iceIDForLog(nActiveDiscoveryResultDeviceDetailID);
}
var sDescription = [Link]("LogAddActiveDisco
veryDevice_Message", sDeviceDisplayName, sGroupDisplayName);
var sDetails = "nDeviceGroupID=" + nDeviceGroupID;
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
function LogAddActiveDiscoveryActiveMonitor(nDeviceID, nActiveDiscoveryResultSer
viceDetailID,sDisplayName, sMonitorName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
if(sMonitorName == null)
{
sMonitorName = _GetActiveMonitorTypeNameFromActiveDiscoveryServi
ceIDForLog(nActiveDiscoveryResultServiceDetailID);
}
var sDescription = [Link]("LogAddActiveDisco
veryActiveMonitor_Message", sMonitorName, sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
function LogAddActiveDiscoveryPerformanceMonitor(nDeviceID, nActiveDiscoveryResu
ltStatisticalMonitorDetailID,sDisplayName, sMonitorName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
if(sMonitorName == null)
{
sMonitorName = _GetStatisticalMonitorTypeNameFromActiveDiscovery
StatisticalMonitorIDForLog(nActiveDiscoveryResultStatisticalMonitorDetailID);
}
var sDescription = [Link]("LogAddActiveDisco
veryPerformanceMonitor_Message", sMonitorName,
sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
//--// Action type logging
{
if (null == sActiveMonitorTypeName)
{
sActiveMonitorTypeName = _GetActiveMonitorTypeNameForLog(nActive
MonitorTypeID);
}
var sDescription = [Link]("LogEditedActiveMo
nitorType_Message", sActiveMonitorTypeName);
var sDetails = "nActiveMonitorTypeID=" + nActiveMonitorTypeID;
_LogUserMessage(_GetTranslatedCategory(ACTIVE_MONITOR), sDetails, sDescr
iption);
}
//--// Passive Monitor library logging
//--function LogCreatedPassiveMonitorType(nPassiveMonitorTypeID, sPassiveMonitorType
Name)
{
if (null == sPassiveMonitorTypeName)
{
sPassiveMonitorTypeName = _GetPassiveMonitorTypeNameForLog(nPass
iveMonitorTypeID);
}
var sDescription = [Link]("LogCreatedPassive
MonitorType_Message", sPassiveMonitorTypeName);
var sDetails = "nPassiveMonitorTypeID=" + nPassiveMonitorTypeID;
_LogUserMessage(_GetTranslatedCategory(PASSIVE_MONITOR), sDetails, sDesc
ription);
}
function LogDeletedPassiveMonitorType(nPassiveMonitorTypeID, sPassiveMonitorType
Name)
{
if (null == sPassiveMonitorTypeName)
{
sPassiveMonitorTypeName = _GetPassiveMonitorTypeNameForLog(nPass
iveMonitorTypeID);
}
var sDescription = [Link]("LogDeletedPassive
MonitorType_Message", sPassiveMonitorTypeName);
var sDetails = "nPassiveMonitorTypeID=" + nPassiveMonitorTypeID;
_LogUserMessage(_GetTranslatedCategory(PASSIVE_MONITOR), sDetails, sDesc
ription);
}
function LogEditedPassiveMonitorType(nPassiveMonitorTypeID, sPassiveMonitorTypeN
ame)
{
if (null == sPassiveMonitorTypeName)
{
sPassiveMonitorTypeName = _GetPassiveMonitorTypeNameForLog(nPass
iveMonitorTypeID);
}
var sDescription = [Link]("LogEditedPassiveM
onitorType_Message", sPassiveMonitorTypeName);
var sDetails = "nPassiveMonitorTypeID=" + nPassiveMonitorTypeID;
_LogUserMessage(_GetTranslatedCategory(PASSIVE_MONITOR), sDetails, sDesc
ription);
}
n);
}
//--// System logging
//--function LogEditedIPSecurity()
{
var sDescription = [Link]("LogModifedIpSecur
ity_Message");
var sDetails = "nWebUserID=" + GetUserID();
_LogUserMessage(_GetTranslatedCategory(SYSTEM), sDetails, sDescription);
}
function LogEditedWEBServerSettings()
{
var sDescription = [Link]("LogModifedWEBSett
ings_Message");
var sDetails = "nWebUserID=" + GetUserID();
_LogUserMessage(_GetTranslatedCategory(SYSTEM), sDetails, sDescription);
}
function LogModifiedLDAPCredentials()
{
var sDescription = [Link]("LogModifiedLDAPCr
edentials_Message");
var sDetails = "";
_LogUserMessage(_GetTranslatedCategory(SYSTEM), sDetails, sDescription);
}
//--// Web alarm logging
//--function LogDismissedWebAlarmItem(nWebAlarmID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameFromWebAlarmIDForLog(nWebAla
rmID)
}
var sDescription = [Link]("LogDismissedWebAl
armItem_Message", sDisplayName);
var sDetails = "";
_LogUserMessage(_GetTranslatedCategory(SYSTEM), sDetails, sDescription);
}
function LogDismissedAllWebAlarm()
{
var sDescription = [Link]("LogDismissedAllWe
bAlarm_Message");
var sDetails = "";
_LogUserMessage(_GetTranslatedCategory(SYSTEM), sDetails, sDescription);
}
function LogDeletedRemoteServer(nRemoteServerID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetRemoteServerDisplayNameForLog(nRemoteServerID
);
}
="General";
="Monitors / Actions";
="Devices";
="Reports";
="Alert Center";
="Netflow";
="Remote";
// these rights are shown in the web user dialog in the order that that are adde
d here
_AddUserRight(USERRIGHT_CHANGEYOURPASSWORD,
"Change
Your Password",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
_AddUserRight(USERRIGHT_MANAGEWORKSPACEVIEWS,
"Manage Workspac
e Views",
UR_CATEGORY_GENERAL,
FEATURE_
NONE);
_AddUserRight(USERRIGHT_CONFIGUREWORKSPACES,
"Configure Works
paces",
UR_CATEGORY_GENERAL,
FEATURE_
NONE);
_AddUserRight(USERRIGHT_MANAGEUSERS,
"Manage
Users",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
_AddUserRight(USERRIGHT_MANAGEIPSECURITY,
"Manage
IP Security",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGURELDAPCREDENTIALS,
"Configure LDAP
Credentials",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
_AddUserRight(USERRIGHT_MANAGEWEBSERVER,
Web Server",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGUREMIBS,
SNMP MIBs",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
_AddUserRight(USERRIGHT_TRANSLATION,
tions",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
"Manage
"Manage
"Transla
_AddUserRight(USERRIGHT_CONFIGUREACTIVEMONITORS,
"Configure Activ
e Monitors",
UR_CATEGORY_MONITORS_ACTIONS, FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGUREPASSIVEMONITORS,
"Configure Passi
ve Monitors",
UR_CATEGORY_MONITORS_ACTIONS, FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGUREPERFORMANCEMONITORS, "Configure Performance M
onitors",
UR_CATEGORY_MONITORS_ACTIONS, FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGUREACTIONPOLICIES,
"Configure Actio
n Policies",
UR_CATEGORY_MONITORS_ACTIONS, FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGUREACTIONS,
"Configu
re Actions",
UR_CATEGORY_MONITORS_ACTIONS, FEATURE_
NONE);
_AddUserRight(USERRIGHT_MANAGERECURRINGACTIONS,
"Manage Recurrin
g Actions",
UR_CATEGORY_MONITORS_ACTIONS, FEATURE_NONE);
_AddUserRight(USERRIGHT_MANAGEGROUPS,
"Manage
Groups",
UR_CATEGORY_DEVICES,
FEATURE_NONE);
_AddUserRight(USERRIGHT_MANAGEDEVICES,
"Manage
Devices",
UR_CATEGORY_DEVICES,
FEATURE_NONE);
_AddUserRight(USERRIGHT_ACCESSACTIVEDISCOVERY,
"Access Active D
iscovery Results",
UR_CATEGORY_DEVICES,
FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGURECREDENTIALS,
"Configure Crede
ntials",
UR_CATEGORY_DEVICES,
FEATURE_
NONE);
_AddUserRight(USERRIGHT_ACCESSGROUPANDDEVICEREPORTS,
"Access Group and Device
Reports",
UR_CATEGORY_REPORTS,
FEATURE_NONE);
_AddUserRight(USERRIGHT_ACCESSSYSTEMREPORTS,
"Access System R
eports",
UR_CATEGORY_REPORTS,
FEATURE_
NONE);
_AddUserRight(USERRIGHT_ACCESSSSGREPORTS,
"Access
SSG Reports",
UR_CATEGORY_REPORTS,
FEATURE_SSG);
_AddUserRight(USERRIGHT_ACCESSALERTCENTERREPORTS,
nter Reports",
UR_CATEGORY_ALERTCENTER,
NTER);
_AddUserRight(USERRIGHT_CONFIGUREALERTCENTER,
Center",
UR_CATEGORY_ALERTCENTER,
ALERT_CENTER);
"Access Alert Ce
FEATURE_ALERT_CE
_AddUserRight(USERRIGHT_ACCESSNETFLOWREPORTS,
Reports",
UR_CATEGORY_NETFLOW,
NETFLOW);
_AddUserRight(USERRIGHT_NETFLOWCONFIGURE,
re Netflow",
UR_CATEGORY_NETFLOW,
FEATURE_NETFLOW);
"Access Netflow
FEATURE_
_AddUserRight(USERRIGHT_ACCESSREMOTEREPORTS,
"Access Remote R
"Configure Alert
FEATURE_
"Configu
eports",
UR_CATEGORY_REMOTE,
FEATURE_DSTSERVER);
_AddUserRight(USERRIGHT_CONFIGUREREMOTESERVERS,
e Sites",
UR_CATEGORY_REMOTE,
FEATURE_DSTSERVER);
"Configure Remot
{
var oUserRightBits = new Array();
for(var i = 0; i < _oUserRights.length; i++)
{
[Link](_oUserRights[i].m_nUserRight);
}
return oUserRightBits;
}
// returns a sorted object array of user rights
function GetUserRights()
{
return _oUserRights;
}
//--// Returns a boolean - true if the user has nUserRight
//
false if not. The nUserRightsMask is optional in case
//
there is need to test a different user
//
(other than the currently logged in user)
//--function UserHasRight(nUserRight, nUserRightsMask)
{
// if nUserRightsMask is omitted then it uses the current users mask
if(nUserRightsMask == null)
{
nUserRightsMask = _GetUserRightsMask();
}
// if the user right name does not exist than the feature associated wit
h the user right
// is not enabled so return false
var sUserRightName = GetUserRightName(nUserRight);
if(sUserRightName == null)
{
return false;
}
// check for the hex in case the value comes from the db - this is
if(nUserRightsMask == USERRIGHT_ALL)
{
return true;
}
// nUserRightsMask could be null if the user is the console or a webarch
ive
if(nUserRightsMask == null)
{
return false;
}
else
{
return (nUserRightsMask & nUserRight) == nUserRight;
}
}
//--// Attempts to log the user in
//--function UserLogin(sUserName, sPassword)
{
_CheckProductLicense();
sPassword = sPassword || "";
var oUser = [Link]("[Link]");
var oResult = [Link](sUserName, sPassword);
if([Link])
{
var sLoginError = [Link]("UserLoginError", o
[Link]);
[Link](sLoginError);
return false;
}
Session("nWebUserID")
Session("sUserName")
Session("nUserRightsMask")
Session("nHomeDeviceGroupID")
=
=
=
=
oUser.m_nUserID;
sUserName;
oUser.m_nUserRightsMask;
_GetUsersHomeDeviceGroupID(oUser.m_nUser
ID);
Session("WebUserData") = null;
SetUserLanguageID(oUser.m_nLanguageID);
if(IsDashboardRequest()==false)
{
// don't log if if a dashboard request as it
// creates a new session every refresh
LogUserLoggedIn();
}
if(IsUserDemoUser())
{
if(!IsDemoServerEnabled())
{
var sLoginError = [Link]("DemoUserLo
ginError");
[Link](sLoginError);
UserLogout();
return false;
}
Session("bShowDemoUserMessage") = true;
}
return true;
}
//--// Logs the user out
//--function UserLogout()
{
// set all user session variables to null
if(IsDashboardRequest()==false)
{
// don't log if if a dashboard request as it
// creates a new session every refresh
LogUserLoggedOut();
}
Session("USER_GROUP_ACCESS_" + GetUserIDForGroupAccess()) = null;
Session("USER_DEVICE_ACCESS_" + GetUserIDForGroupAccess()) = null;
Session("sRedirectUrl") = null;
Session("nWebUserID") = null;
Session("sUserName") = null;
Session("nUserRightsMask") = null;
Session("nHomeDeviceGroupID") = null;
SetUserLanguageID(null);
Session("UsersRootDeviceGroupID") = null;
Session("WebUserData") = null;
Session("bShowDemoUserMessage") = null;
}
// tests to see if the request came from the dashboard
function IsDashboardRequest()
{
var bIsDashboardRequest = parseInt([Link]("bIsDashboa
rdRequest"));
if(bIsDashboardRequest==1)
{
return true;
}
return false;
}
// May want to add logic for determining the users home
function UserGetHomeUrl()
{
return "/NmConsole/Workspace/HomeWorkspace/[Link]";
}
//--// Get the current user id. If null then the user is not logged in.
//--function GetUserID()
{
// if a web archive or the console then return the admin userid
if(IsUserAWebArchive())
{
Session("nWebUserID") = ADMIN_USERID;
return ADMIN_USERID;
}
else if(Session("nWebUserID") == null)
{
return null;
}
else
{
return parseInt(Session("nWebUserID"));
}
}
//--// Get the current users name. If null then the user is not logged in.
//--function GetUserName()
{
// if a web archive or the console then return the admin user name
if(IsUserAWebArchive())
{
return ADMIN_USERNAME;
}
else
{
return Session("sUserName");
}
}
//--// Get the users language id. If null return english.
//--function GetUserLanguageID()
{
if(Session("nUserLanguageID") == null)
{
return LANGUAGEID_ENGLISH;
}
else
{
return Session("nUserLanguageID");
}
}
//--// Get the admuin users language id. If null return english.
//--function GetAdminUserLanguageID()
{
if(Session("ADMIN_nLanguageID") != null)
{
return Session("ADMIN_nLanguageID");
}
var oDb = GetDb();
var sSql = "SELECT nLanguageID FROM WebUser WHERE nWebUserID = " + ADMIN
_USERID;
var oResult = [Link](sSql);
if ([Link])
{
var sTranlsationError = [Link]("GetAdminUser
LanguageID_Error", [Link]);
[Link](sTranlsationError);
return LANGUAGEID_ENGLISH;
}
var nLanguageID = LANGUAGEID_ENGLISH;
if(![Link])
{
nLanguageID = [Link]("nLanguageID");
}
Session("ADMIN_nLanguageID") = nLanguageID;
return nLanguageID;
}
// transform the ipswitch web server session ID to
// match the IIS session ID
function GetUserSessionIDAsNumber()
{
if( IsWebServerIpswitch() )
{
var sID = String([Link]);
var oRegEx = new RegExp("(\\D+)", "g");
sID = [Link](oRegEx, "");
if( [Link] > 9 )
{
case WBU_DEVICESTAB_REFRESHINTERVAL:
return REFRESH_DEFAULT;
case WUD_WEBALARMS_REFRESHINTERVAL:
return REFRESH_DEFAULT;
case WUD_SHOWBUBBLE_ONWORKSPACEREPORTS:
return SHOWBUBBLE_DEFAULT;
case WUD_SHOWBUBBLE_ONFULLREPORTS:
return SHOWBUBBLE_DEFAULT;
case WUD_DYNAMICSSGLEGENDS:
return "false";
case WUD_SHOWNETFLOW_TOOLTIPS:
return SHOWTOOLTIPS_DEFAULT;
}
return sValue
}
function SetWebUserData(nWebUserID, sName, sValue)
{
var oDb = GetDb();
var sSql = ""
+ "SET NOCOUNT ON "
+ "UPDATE WebUserData SET "
+ " sValue = " + [Link](sValue) + " "
+ "WHERE nWebUserID = " + nWebUserID
+ "
AND sName = " + [Link](sName) + " "
+ "SELECT @@ROWCOUNT AS nRowsAffected";
var oResult = [Link](sSql);
if([Link] || [Link])
{
[Link]([Link]);
return false;
}
// determine if the update effected any rows
var nUpdatedRows = [Link]("nRowsAffected");
if(0 != nUpdatedRows)
{
// update worked
Session("WebUserData") = null;
return true;
}
// update did not effect any rows so do an insert
var sSql = ""
+ "INSERT INTO WebUserData "
+ "(nWebUserID, sName, sValue) "
+ "VALUES "
+ "(" + nWebUserID + ","
+ [Link](sName) + ","
+ [Link](sValue) + ")";
var oResult = [Link](sSql);
if([Link])
{
[Link]([Link]);
return false;
}
Session("WebUserData") = null;
return true;
}
function IsUserDemoUser()
{
var bIsDemoUser = GetWebUserData(WUD_ISDEMOUSER);
if(bIsDemoUser == "1")
{
return true;
}
else
{
return false;
}
}
function DemoUserIsRestricted(sAdditionalMessage)
{
if(IsUserDemoUser())
{
if(sAdditionalMessage == null)
{
sAdditionalMessage = "";
}
else
{
sAdditionalMessage = "\n\n" + sAdditionalMessage;
}
var sError = [Link]("DemoUserRestricted", sA
dditionalMessage);
[Link](sError);
return true;
}
return false;
}
//--// User Group / Device Access
//--var DEVICE_READ = 4;
var DEVICE_WRITE = 3;
var GROUP_READ = 2;
var GROUP_WRITE = 1;
// Determines if the user has specified access rights to the specified group
function UserHasGroupAccess(nDeviceGroupID, nAccessType)
{
// if just trying to read the default all devices group then
// allow this since userrights will take care of the rest
if(nAccessType==GROUP_READ && nDeviceGroupID==GROUPID_ALLDEVICES)
{
return true;
}
// User also needs manage groups rights for group write right
if(nAccessType == GROUP_WRITE && false == UserHasRight(USERRIGHT_MANAGEG
ROUPS))
{
return false;
}
// if the current user is the admin always return true
if(GetUserIDForGroupAccess() == ADMIN_USERID)
{
return true;
}
var oRights = _GetUserGroupRights(nDeviceGroupID)
if(oRights[nAccessType] > 0)
{
return true;
}
else
{
return false;
}
}
// Determines if the user has specified access rights to the specified device
function UserHasDeviceAccess(nDeviceID, nAccessType)
{
// User also needs manage devices rights for device write right
if(nAccessType == DEVICE_WRITE && false == UserHasRight(USERRIGHT_MANAGE
DEVICES))
{
return false;
}
// if the current user is the admin always return true
if(GetUserIDForGroupAccess() == ADMIN_USERID)
{
return true;
}
var oRights = _GetUserDeviceRights(nDeviceID)
if(oRights[nAccessType] > 0)
{
return true;
}
else
{
return false;
}
}
// Checks if the access rights are enabled
// and returns the user id to use for access rights
function GetUserIDForGroupAccess()
{
if(GetUserID() == ADMIN_USERID)
{
return ADMIN_USERID;
}
else if(_IsUserGroupAccessEnabled())
{
return GetUserID();
}
else
{
return ADMIN_USERID;
}
}
function IsUserGroupAccessEnabled()
{
return _IsUserGroupAccessEnabled()
}
var g_oTranslateForAdmin = null;
function GetTranslationObjectForAdminUser()
{
if(g_oTranslateForAdmin != null)
{
return g_oTranslateForAdmin;
}
g_oTranslateForAdmin = [Link]("CoreAsp" + ".Translate");
g_oTranslateForAdmin.Initialize("[Link]", GetAdminUserLanguageID());
return g_oTranslateForAdmin;
}
// gets the sValue from the GlobalSettings db table associated with sName
// if there is an error or IsEOF then the function will return null
function GetGlobalSetting(sName)
{
var oDb = GetCacheDb();
var sSql = "SELECT sValue FROM GlobalSettings WHERE sName = " + [Link]
eString(sName);
var oResult = [Link](sSql);
if([Link]==true)
{
[Link]([Link]);
return null;
}
if([Link]==true)
{
return null;
}
return [Link]("sValue");
}
// inserts or updates a row in the GlobalSettings db table
function SetGlobalSetting(sName, sValue)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SET NOCOUNT ON "
+ "UPDATE GlobalSettings SET "
+ " sValue = " + [Link](sValue) + " "
+ "WHERE sName = " + [Link](sName)
+ "SELECT @@ROWCOUNT AS nRowsAffected";
var oResult = [Link](sSql);
if([Link] || [Link])
{
[Link]([Link]);
return false;
}
// determine if the update effected any rows
var nUpdatedRows = [Link]("nRowsAffected");
if(0 != nUpdatedRows)
{
// update worked
return true;
}
// update did not effect any rows so do an insert
var sSql = ""
+ "INSERT INTO GlobalSettings "
+ "(sName, sValue) "
+ "VALUES "
+ "(" + [Link](sName) + ","
+ [Link](sValue) + ")";
var oResult = [Link](sSql);
if([Link])
{
[Link]([Link]);
return false;
}
return true;
}
// make the users configure rights available to the client for
// building the dynamic configure menu
_WriteConfigureMenuAccessRights();
// function to test if the user has turned off a certain bubble type
function IsBubbleTypeTurnedOn(nBubbleType)
{
switch(nBubbleType)
{
case BUBBLETYPE_WORKSPACEREPORT:
if(GetWebUserData(WUD_SHOWBUBBLE_ONWORKSPACEREPORTS) ==
"false")
{
return false;
break;
}
else
{
return true;
break;
}
case BUBBLETYPE_FULLREPORT:
if(GetWebUserData(WUD_SHOWBUBBLE_ONFULLREPORTS) == "fals
e")
{
return false;
break;
}
}
return true;
}
function IsTooltipEnabled()
{
if(GetWebUserData(WUD_SHOWNETFLOW_TOOLTIPS) == "false")
{
return false;
}
return true;
}
[Link]("\n");
[Link]();
var oRequest = InitializeRequest();
var oResponse = InitializeResponse();
// if user does not have manage device right then return false
if(!UserHasRight(USERRIGHT_MANAGEDEVICES))
{
oResponse.m_bHasWebAlarms = false;
SendResult(oResponse);
}
// get the list of webalarms
var sPivotDeviceToGroupTable = GetUniqueTempTableName();
var sSql = "EXEC LoadDeviceGroup -1, " + GetUserIDForGroupAccess() + ", '" + sPi
votDeviceToGroupTable + "' " +
"SELECT [Link], " +
"
[Link], " +
"
[Link], " +
"
[Link], " +
"
[Link], " +
"
[Link], " +
"
[Link], " +
"
[Link], " +
"
[Link], " +
"
[Link] AS sActiveMon
itorTypeName, " +
"
[Link], " +
"
[Link], " +
"
[Link], " +
"
[Link] " +
"FROM WebAlarmLog " +
"INNER JOIN Device ON [Link] = [Link]
viceID " +
"INNER JOIN NetworkInterface ON [Link]
kInterfaceID = " +
"
[Link] " +
"LEFT OUTER JOIN MonitorState ON [Link]
ateID = " +
"
[Link] " +
"LEFT OUTER JOIN PivotActiveMonitorTypeToDevice ON " +
"
[Link]
orTypeToDeviceID = " +
"
[Link] "
+
"LEFT OUTER JOIN ActiveMonitorType ON PivotActiveMonitor
[Link] = " +
"
[Link] " +
"INNER JOIN " + sPivotDeviceToGroupTable +
"
P ON [Link]=[Link] " +
"WHERE [Link] = 0
" +
"ORDER by dDateTime DESC";