home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2003-06-24 | 141.9 KB | 4,016 lines
var CMode = ""; // Mode of Operation, New, Edit, Delete, Lookup var IMode = ""; // Initial Lookup mode var IModeFirstTimeServer = true; var IModeFirstTimeGroup = true; var CName = "*"; // Computer Name var OrigCName = "*"; // Origianl Computer Name var CGrpID = "*"; // Computer Group ID var CurSelectIdx = 0; // Index of currently selected Computer name in Combo var CompDeleteID = null; // ID of Computer to Delete var ServicesCheckingStopped = false; var allGrpSelected = 0; // All Groups selected for Lookup var bdH = 0; var byM = null; var borderSz = 2; // Thin Bord is 2pixels var Tid = null, CTid = null; // Timeout ID var StopFlag = false; // abort Discovery process var ELogWinInit = ""; // save for ElogWin init HTML var AgentWinInit = ""; var ELBgFlg = 0; // Alert Event Log Backgrounf color toggle var ELIdx = 0; // Discovery Log Index var ELChkBoxCount = 0; // Discovery Log check box var PuPW = "400px", PuPWu=400, PuPH = "280px", PuPHu=270, PuPCH = "235px"; var AddServicesArr = new Array(); var AddServicesArrIdx = 0; var AddServicesFlag = 0; //1=Add with Edit first; 2=Add without Edit var tpingchk=false ,tpingto="5",tpingret=""; var thttpchk=false,thttpport="",thttpto="5",thttplookfor="",thttponpage=""; var tftpchk=false,tftpport="",tftpto="5"; var ttelchk=false, ttelport="", ttelto="5"; var tsmtpchk=false,tsmtpport="",tsmtpto="5"; var tpopchk=false,tpopport="",tpopto="5"; var tdnschk=false,tdnsport="",tdnsto="5",tdnsret="",tdnsname=""; var tuserchk=false,tuserport="",tuserto="5",tuserret="",tuserrqst="",tuserresp="",tuserpart=""; var tsqlchk=false,tsqlto="",tsqlparms=",sa,,"; var toraclechk=false,toracleto="",toracleparms=",sa,,"; var tsnmpchk=false,tsnmpto="5",tsnmpret="",tsnmpparms="public,public,1"; var thttpsec=tftpsec=tpopsec=tsmtpsec=ttelsec=""; var tlnoteschk=false,tlnotesport="",tlnotesto="5",tlnotesret="",tlnotesrqst="",tlnotesresp="",tlnotespart=""; var DefaultServiceTimeOut = "5"; // seconds var DefaultPingTimeOut = "2"; // seconds var ServiceTypeCount=11; // count of services monitored var FStorIdx = null; // Index to Found Service in Store var ServEditCID = null; // Edited Computer ID var ServStorIdx = null; // Index to Start of Services in Store for Computer ID var ServEditMode = null; // Database Operation Required for Edit Update var ServEditCount = 0; // Count of Services Updated var ServiceCompID = null; // Computer ID for current Service Records Received var ServAddStrg = null; // Service Record Store string var TotalComputersAdded = 0; // count of computers added from Discovery var ignoreDBChangeEvent = 0; var LicenseMax = 10; // maximum licenses available var LicenseCur = 0; // current license used var ServiceThreadToggleRequired = false; var AC_StoreArr = new Array(); var ComputerRecLength = 12; // Computer Lookup record length var LupRecCount = 0; // Count of records returned from Computer Lookup operation var AC_ServicesStoreArr = new Array(); var ServicesRecCount = 0; // Count of records returned from Services Lookup operation var ServicesRecLength = 2; // Services Lookup record length var EnumeratedServersArr = new Array(); var EnumeratedServersRecLength = 7; var CurrentLocalDomain = ""; var ReconnectEvent = false; var Hp = 82; var LastNew = ""; var DtypTxt = new Array("",""," -workgroup"," -standalone"); // Server type flags var SV_TYPE_WORKSTATION = 0x00000001 var SV_TYPE_SERVER = 0x00000002 var SV_TYPE_SQLSERVER = 0x00000004 var SV_TYPE_DOMAIN_CTRL = 0x00000008 var SV_TYPE_DOMAIN_BAKCTRL = 0x00000010 var SV_TYPE_TIME_SOURCE = 0x00000020 var SV_TYPE_AFP = 0x00000040 var SV_TYPE_NOVELL = 0x00000080 var SV_TYPE_DOMAIN_MEMBER = 0x00000100 var SV_TYPE_PRINTQ_SERVER = 0x00000200 var SV_TYPE_DIALIN_SERVER = 0x00000400 var SV_TYPE_XENIX_SERVER = 0x00000800 var SV_TYPE_SERVER_UNIX = SV_TYPE_XENIX_SERVER var SV_TYPE_NT = 0x00001000 var SV_TYPE_WFW = 0x00002000 var SV_TYPE_SERVER_MFPN = 0x00004000 var SV_TYPE_SERVER_NT = 0x00008000 var SV_TYPE_POTENTIAL_BROWSER = 0x00010000 var SV_TYPE_BACKUP_BROWSER = 0x00020000 var SV_TYPE_MASTER_BROWSER = 0x00040000 var SV_TYPE_DOMAIN_MASTER = 0x00080000 var SV_TYPE_SERVER_OSF = 0x00100000 var SV_TYPE_SERVER_VMS = 0x00200000 var SV_TYPE_WINDOWS = 0x00400000 // Windows95 and above var SV_TYPE_DFS = 0x00800000 // Root of a DFS tree var SV_TYPE_CLUSTER_NT = 0x01000000 // NT Cluster var SV_TYPE_DCE = 0x10000000 // IBM DSS (Directory and Security Services) or equivalent var SV_TYPE_ALTERNATE_XPORT = 0x20000000 // return list for alternate transport var SV_TYPE_LOCAL_LIST_ONLY = 0x40000000 // Return local list only var SV_TYPE_DOMAIN_ENUM = 0x80000000 var SV_TYPE_ALL = 0xFFFFFFFF // handy for NetServerEnum2 /* On Load tell the Comm control to Connect to the Server */ function InitRpmCC_AC() { top.MainLoaded = true; // Flag that Main is now loaded initButtonState(); // set initial button state for all buttons ELogWinInit = ELogWin.innerHTML; // save init state AgentWinInit = AgentWin.innerHTML; // save init state byM = 2*parseFloat(document.body.style.margin); processSizeChange(); // Initialize Port Base field var IPArr = document.body.RPMHostIP.split("."); if ( IPArr[0] == "127" && IPArr[1] == "0" ) { IPArr = origRPMHostIP.split("."); if ( IPArr.length < 4 ) { IPArr = RpmMIL.ResolveNameToIPAddr(origRPMHostIP).split("."); } } else if ( IPArr.length < 4 ) { IPArr = RpmMIL.ResolveNameToIPAddr(origRPMHostIP).split("."); } quad1.value = IPArr[0]; quad2.value = IPArr[1]; quad3.value = IPArr[2]; /* Get Discovery Show All & Get Domain checkbox state */ cc = top.banner.RpmCC_Ban.RegGetKey(top.banner.ServerID+"DiscoveryShowAllState"); // get state if ( cc == "unchecked" ) { // If not checked ShowAllEnabled.checked = ""; } else { ShowAllEnabled.checked = "CHECKED"; } cc = top.banner.RpmCC_Ban.RegGetKey(top.banner.ServerID+"DiscoveryGetDomainState"); // get state if ( cc == "unchecked" ) { // If not checked DomainLUP.checked = ""; } else { DomainLUP.checked = "CHECKED"; } cc = top.banner.RpmCC_Ban.RegGetKey(top.banner.ServerID+"ShowAllDomain"); // get state if ( cc == "unchecked" ) { // If not checked ShowAllDomain.checked = ""; } else { ShowAllDomain.checked = "CHECKED"; } cc = top.banner.RpmCC_Ban.RegGetKey(top.banner.ServerID+"DomainFilter"); // get state if ( cc != "" ) { var warr = new Array(); warr = cc.split("~"); filter_servers.checked = warr[0]; filter_ws.checked = warr[1]; filter_pdc.checked = warr[2]; filter_bdc.checked = warr[3]; filter_sql.checked = warr[4]; filter_notdc.checked = warr[5]; filter_cluster.checked = warr[6]; filter_pq.checked = warr[7]; } Hp = parseInt(document.body.RPMHostPort,10); RpmCC_AC.Connect(document.body.RPMHostIP, Hp, ""); } function processConnectConfirmed() { processResetDone(); SetButtonState(CResetButton,"1"); SetButtonState(CUpdateButton,"1"); SetButtonState(CEditButton,"1"); SetButtonState(CDupButton,"1"); SetButtonState(CDeleteButton,"1"); SetButtonState(CNewButton,"1"); SetButtonState(DiscoveryButton,"1"); SetButtonState(InstallAgentButton,"1"); SetButtonState(ManageAgentsButton,"1"); SetButtonState(WMButton,"1"); if ( ReconnectEvent == false ) { RpmCC_AC.GetLicenseCount(); // get Server license count IMode = "Lookup"; UserLupRecCount = 0; // clear Lookup record counter AC_DomainArr.length = 0; if ( RpmCC_AC.UserLookup("DOMAINNAME:","") ) { top.Rstatus.Pstat("Unable to start the SERVER LOOKUP request",true); IMode = ""; // reset } ReconnectEvent = true; } top.Rstatus.Pstat("Connected"); if ( Tid != null ) { clearTimeout(Tid); // stop timeout routine } Tid = setTimeout("processConnectionCheck()",30000); // Delay 30 secs then check connection } function processReconnect() { Tid = null; if ( RpmCC_AC.IsConnected() ) { Tid = setTimeout("processConnectionCheck()",30000); // Delay 30 secs then check connection return; } RpmCC_AC.Connect(document.body.RPMHostIP,Hp, ""); } function processConnectionCheck() { Tid = null; RpmCC_AC.SendKeepAlive("Check"); Tid = setTimeout("processConnectionCheck()",30000); // Delay 30 secs then check connection } /* On Unload tell the Comm control to Disconnect from the Server */ function DiscoRpmCC_AC() { top.QuickStartProcessing = false; RpmCC_AC.Disconnect(); top.banner.processStopCommX(); if ( Tid != null ) { clearTimeout(Tid); // stop timeout routine } if ( CTid != null ) { clearTimeout(CTid); // stop timeout routine } // Save Discovery Show All & Get Domain checkbox state cc = ( ShowAllEnabled.checked == false ) ? "unchecked" : "checked"; top.banner.RpmCC_Ban.RegSetKey(top.banner.ServerID+"DiscoveryShowAllState",cc); // set state cc = ( DomainLUP.checked == false ) ? "unchecked" : "checked"; top.banner.RpmCC_Ban.RegSetKey(top.banner.ServerID+"DiscoveryGetDomainState",cc); // set state cc = ( ShowAllDomain.checked == false ) ? "unchecked" : "checked"; top.banner.RpmCC_Ban.RegSetKey(top.banner.ServerID+"ShowAllDomain",cc); // set state var warr = new Array(); warr[0] = ( filter_servers.checked ) ? "checked" : ""; warr[1] = ( filter_ws.checked ) ? "checked" : ""; warr[2] = ( filter_pdc.checked ) ? "checked" : ""; warr[3] = ( filter_bdc.checked ) ? "checked" : ""; warr[4] = ( filter_sql.checked ) ? "checked" : ""; warr[5] = ( filter_notdc.checked ) ? "checked" : ""; warr[6] = ( filter_cluster.checked ) ? "checked" : ""; warr[7] = ( filter_pq.checked ) ? "checked" : ""; cc = warr.join("~"); top.banner.RpmCC_Ban.RegSetKey(top.banner.ServerID+"DomainFilter",cc); // set state } /* Process Domain LOOKUP RECORD Event */ var AC_DomainArr = new Array(); var UserRecLength = 6; var UserLupRecCount = 0; function processUserLookupRecord(Did,DName,DDesc,UPswd,UName,UItype) { var i = UserRecLength * UserLupRecCount; if ( i == 0 ) { // if first one AC_DomainArr[i+0] = "(ALL)"; AC_DomainArr[i+1] = "0"; AC_DomainArr[i+2] = "All Domains Listed"; AC_DomainArr[i+3] = ""; AC_DomainArr[i+4] = ""; AC_DomainArr[i+5] = "0"; ++UserLupRecCount; // bump record received counter i = UserRecLength * UserLupRecCount; } AC_DomainArr[i+0] = DName; AC_DomainArr[i+1] = Did; AC_DomainArr[i+2] = DDesc; AC_DomainArr[i+3] = UPswd; AC_DomainArr[i+4] = UName; AC_DomainArr[i+5] = UItype; ++UserLupRecCount; // bump record received counter } /* Process DB Error in User Lookup Operation */ function processUserOpError() { top.Rstatus.Pstat("An error occurred during Domain LOOKUP operation",true); } function processUserOpComplete() { // Look up MonitorIT Servers if ( RpmCC_AC.AdminServersLookup("*") ) { top.Rstatus.Pstat("Unable to start the SERVER LOOKUP request",true); IMode = ""; // reset } } // Process Display View Size Change var SCbsy = false; var MomPuPW = "330px", MomPuPWu=330; var PuPOIDW = "500px", PuPOIDWu=500, PuPOIDCH = "326px"; function processSizeChange() { if ( SCbsy ) return; SCbsy = true; // Display Height and Width bCh = document.body.clientHeight; bCw = document.body.clientWidth; // PopUp PuPLeft = (bCw-PuPWu)/2; PuPTop = (bCh-PuPHu)/2; PopUpDiv.style.left = PuPLeft+"px"; PopUpDiv.style.top = "1px"; //PuPTop+"px"; PopUpDiv.style.height = PuPH; PopUpDiv.style.width = PuPW; PopUpConfirm.style.left = PuPLeft+"px"; PopUpConfirm.style.top = "150px"; //PuPTop+"px"; PopUpConfirm.style.height = PuPCH; PopUpConfirm.style.width = PuPW; PopUpDomain.style.left = ((bCw-300)/2)+"px"; PopUpDomain.style.top = "180px"; PopUpDomain.style.height = "100px"; PopUpDomain.style.width = "300px"; PopUpAI.style.left = ((bCw-400)/2)+"px"; PopUpAI.style.top = "180px"; PopUpAI.style.height = "130px"; PopUpAI.style.width = "400px"; LogonInfo.style.left = ((bCw-400)/2)+"px"; LogonInfo.style.top = "135px"; LogonInfo.style.height = "100px"; LogonInfo.style.width = "400px"; //PopUpContext Menu PopUpContextSize(bCw); // Set Height/Widths for Log areas ELogWinMain.style.left = (byM+3)+"px"; ELogWinMain.style.top = "45px"; //"180px"; ELogWinMain.style.height = bCh-(bdH+byM-borderSz)-65; // "340px" ELogWinMain.style.width = bCw-byM-byM-6; ELogWin.style.height = bCh-(bdH+byM-borderSz)-65-55; AgentWinMain.style.left = (byM+3)+"px"; AgentWinMain.style.top = "45px"; //"180px"; AgentWinMain.style.height = bCh-(bdH+byM-borderSz)-65; // "340px" AgentWinMain.style.width = bCw-byM-byM-6; AgentWin.style.height = bCh-(bdH+byM-borderSz)-65-75; DomainFilter.style.left = ((bCw-360)/2)+"px"; DomainFilter.style.top = "65px"; DomainFilter.style.height = "130px"; DomainFilter.style.width = "360px"; PuPWMLeft = (bCw-620)/2; PopUpWatchMember.style.left = PuPWMLeft+"px"; PopUpWatchMember.style.top = "100px"; //PuPTop+"px"; PopUpWatchMember.style.height = (bCh-130)+"px"; //"426px"; PopUpWatchMember.style.width = "620px"; WM_Data.style.height = PopUpWatchMember.style.posHeight-50;//"325px"; PuPWMIRLeft = (bCw-620)/2; PopUpWMIReport.style.left = PuPWMIRLeft+"px"; PopUpWMIReport.style.top = "100px"; //PuPTop+"px"; PopUpWMIReport.style.height = (bCh-130)+"px"; //"426px"; PopUpWMIReport.style.width = "620px"; WMIR_Data.style.height = PopUpWMIReport.style.posHeight-50;//"325px"; PuPOIDLeft = (bCw-PuPOIDWu)/2; PopUpOID.style.left = PuPOIDLeft+"px"; PopUpOID.style.top = "200px"; //PuPTop+"px"; PopUpOID.style.height = PuPOIDCH; PopUpOID.style.width = PuPOIDW; // PopUp MomPuPLeft = (bCw-MomPuPWu)/2; PopUpMoment.style.left = MomPuPLeft+"px"; PopUpMoment.style.top = "125px"; PopUpMoment.style.height = "135px"; PopUpMoment.style.width = MomPuPW; SCbsy = false; } /* Process Click on selected Tab */ var CurSelTab = null; // current selected tab function processGeneralClick(th) { CounterUI.style.display="none"; ServicesUI.style.display="none"; SNMPUI.style.display="none"; CounterTab.className="TabUnsel"; ServicesTab.className="TabUnsel"; SNMPTab.className="TabUnsel"; th.className="TabSel"; CurSelTab = th.id; switch ( th.id ) { case "CounterTab" : CounterUI.style.display=""; // Enable this Tab's view break; case "ServicesTab" : ServicesUI.style.display=""; // Enable this Tab's view break; case "SNMPTab" : if ( GotMIBData ) { displayMIBObjectChoices(); } else { processGetMIBList(0); // get the MIB Object List } SNMPUI.style.display=""; // Enable this Tab's view AC_MIBSel.style.visibility="visible"; break; } /* Select current Computer Name and give it focus */ if ( AC_NameSel.length > 0 ) { AC_NameSel.options[CurSelectIdx].selected = "selected"; if ( AC_NameSel.style.visibility != "hidden" && AC_NameSel.style.display == "") { AC_NameSel.focus(); } } } // Process the New Button Press function processNewButton() { CMode = "New"; // Set Mode of operation tpingchk = "checked"; // default to PING service enabled thttpport = "80"; thttplookfor = ""; thttponpage = ""; tftpport = "21"; tsmtpport = "25"; tpopport = "110"; tdnsport = "53"; tuserport = "100"; ttelport = "23"; tlnotesport = "1352"; tdnsret = tpingret = tuserret = tsnmpret = "2"; thttpto = tftpto = tsmtpto = tpopto = tdnsto = ttelto = tuserto = tsqlto = tsnmpto = DefaultServiceTimeOut; tlnotesto = toracleto = DefaultServiceTimeOut; thttpsec=tftpsec=tpopsec=tsmtpsec=ttelsec=""; tpingto = DefaultPingTimeOut; processServiceSelectPut(); // set up display TotalComputersAdded = 0; // initialize AC_SNMPEnabled.checked = ""; AC_Name.value = ""; AC_Group.value = ""; AC_Pswd.value = ""; AC_VPswd.value = ""; AC_Desc.value = ""; AC_IPAddr.value = ""; AC_Server.value = ""; AC_DomainN.value = ""; AC_OSver.value = ""; AC_AgentVer.value = ""; commonNew_Edit(); // Do common processing for ( var i=0; i<MIBObjectArr.length; i++ ) { MIBObjectCheckArr[i] = "0"; } AC_MIBSel.length = 0; AC_SNMPPort.value = "161"; AC_ReadComm.value = "public"; AC_GroupSel.options[0].selected = "selected"; // Select first Group AC_Group.value = AC_GroupSel.options[0].text; // Sync the field AC_ServerSel.options[0].selected = "selected"; // Prime Port field AC_Server.value = AC_ServerSel.options[0].text; // Sync the field AC_DomainNSel.options[0].selected = "selected"; // Prime Port field AC_DomainN.value = AC_DomainNSel.options[0].value; // Sync the field AC_Port.value = ""+document.body.RPMAgentPort; // Prime Agent Port field SetButtonState(DiscoveryButton,"0"); SetButtonState(VerifyButton,"0"); top.Rstatus.Pstat("Ready"); } function processDuplicateButton() { CMode = "New"; // Set Mode of operation AC_Name.value = ""; TotalComputersAdded = 0; // initialize commonNew_Edit(); // Do common processing SetButtonState(VerifyButton,"0"); getGroupID(AC_Group.value,AC_GrpStore); // Set GrpSelectIdx AC_GroupSel.options[GrpSelectIdx].selected = "selected"; getServerID(AC_Server.value); AC_ServerSel.options[SrvSelectIdx].selected = "selected"; top.Rstatus.Pstat("Done"); processGetMIBList(0); // get the MIB Object List } function processEditButton() { CMode = "Edit"; // Set Mode of operation AC_Name.value = AC_NameSel.options[CurSelectIdx].text; // Selected Computer Name commonNew_Edit(); // Do common processing SetButtonState(VerifyButton,"0"); getGroupID(AC_Group.value,AC_GrpStore); // Set GrpSelectIdx AC_GroupSel.options[GrpSelectIdx].selected = "selected"; getServerID(AC_Server.value); AC_ServerSel.options[SrvSelectIdx].selected = "selected"; top.Rstatus.Pstat("Done"); processGetMIBList(0); // get the MIB Object List } function processLookupButton() { CMode = "Lookup"; // set mode of operation AC_NameSel.className = "idis"; AC_Group.className = "idis"; AC_MIBSel.className = "idis"; /* inhibit combo Group Name; enable one-line input Group Name */ AC_GroupSel.style.display = "none"; AC_Group.style.display = ""; /* Initiate DataBase Computer Lookup Operation */ LupRecCount = 0; // initialize record counter ServiceCompID = null; // init the Service Record Computer ID CurSelectIdx = 0; // reset current select index allGrpSelected = true; AC_StoreArr.length = 0; for ( var i=AC_NameSel.length; i>0; i-- ) { AC_NameSel.remove(0); } if ( RpmCC_AC.ComputerLookup("*","*") ) { top.Rstatus.Pstat("Unable to start the LOOKUP request",true); processResetButton(); } else { // waiting for OperationCompleteEvent SetCursor("wait"); top.banner.processStartComm(); top.Rstatus.Pstat("One moment while LOOKUP request completes"); } } // Manage All Agents var acds = acns = acgs = acms = ""; var CurrentAgentVersion = ""; var saveCMode = "", saveNameSelClass="", saveNameSelDisplay=""; function processManageAgentButton() { ServiceSelect.style.display="none"; acns = AC_NameSel.style.display; AC_NameSel.style.display = "none"; acgs = AC_GroupSel.style.display; AC_GroupSel.style.display = "none"; acds = AC_DomainNSel.style.display; AC_DomainNSel.style.display = "none"; acms = AC_MIBSel.style.display; AC_MIBSel.style.display = "none"; AgentWinMain.style.display = ""; if (filter_domainnameSel.selectedIndex < 0) filter_domainnameSel.selectedIndex = 0; // default to Filter All processRefreshButton(); } function processShowAllFilter() { // Populate Domain Names if any if ( AC_DomainArr.length == 0 ) { filter_domainnameSel.style.display = "none"; filter_domainname.style.display = ""; } else { filter_domainnameSel.style.display = ""; filter_domainname.style.display = "none"; lth = filter_domainnameSel.length; for (i=0; i < lth; ++i) filter_domainnameSel.remove(0); for ( var i=0; i<AC_DomainArr.length; i+=UserRecLength ) { if ( AC_DomainArr[i+5] != "3" ) { addElementToSelect( filter_domainnameSel, AC_DomainArr[i]+DtypTxt[parseInt(AC_DomainArr[i+5],10)] ); } } if ( CurrentFilterSelectedIndex < filter_domainnameSel.length ) filter_domainnameSel.selectedIndex = CurrentFilterSelectedIndex; } DomainFilter.style.display=""; } var CurrentFilterSelectedIndex = 0; function processDomainFilterOKButton() { DomainFilter.style.display="none"; CurrentFilterSelectedIndex = filter_domainnameSel.selectedIndex; } var CurrentDomainIndex = 0; var CurrentDomainEnumerated = ""; function processGetDomainAndFilterSpec() { var filter = 0x0; if ( filter_servers.checked ) filter |= SV_TYPE_DOMAIN_CTRL | SV_TYPE_DOMAIN_BAKCTRL | SV_TYPE_SERVER_NT | SV_TYPE_CLUSTER_NT; if ( filter_ws.checked ) filter |= SV_TYPE_WORKSTATION; if ( filter_pdc.checked ) filter |= SV_TYPE_DOMAIN_CTRL; if ( filter_bdc.checked ) filter |= SV_TYPE_DOMAIN_BAKCTRL; if ( filter_sql.checked ) filter |= SV_TYPE_SQLSERVER; if ( filter_notdc.checked ) filter |= SV_TYPE_SERVER_NT; if ( filter_cluster.checked ) filter |= SV_TYPE_CLUSTER_NT; if ( filter_pq.checked ) filter |= SV_TYPE_PRINTQ_SERVER; var dfspec = ""+filter+"~"+filter_domainname.value; CurrentDomainEnumerated = ( filter_domainname.value == "" ) ? CurrentLocalDomain : filter_domainname.value; if ( CurrentDomainIndex > 0 ) { while ( CurrentDomainIndex < AC_DomainArr.length/UserRecLength ) { if ( AC_DomainArr[(CurrentDomainIndex * UserRecLength)+5] == "3" ) { ++CurrentDomainIndex; continue; } else { break; } } if ( CurrentDomainIndex < AC_DomainArr.length/UserRecLength ) { dfspec = ""+filter+"~"+AC_DomainArr[(CurrentDomainIndex * UserRecLength)]; CurrentDomainEnumerated = AC_DomainArr[(CurrentDomainIndex * UserRecLength)]; return dfspec; } else { return ""; } } return dfspec; } function processRefreshButton() { saveCMode = CMode; CMode = "Lookup_ManageAgent"; // set mode of operation processAgentWindow(); // init the display SetButtonState(GlobalInstallAgentButton,"1"); // disable SetButtonState(RefreshButton,"1"); // disable allGrpSelected = true; LupRecCount = 0; // initialize record counter ServiceCompID = null; // init the Service Record Computer ID CurSelectIdx = 0; // reset current select index AC_StoreArr.length = 0; MomText.innerHTML = ""; PopUpMoment.style.display = ""; SetCursor("wait"); top.banner.processStartComm(); CurrentDomainIndex = 0; EnumeratedServersArr.length = 0; // reset array if ( AC_DomainArr.length > 0 ) { // if nothing selected, default to all if ( filter_domainnameSel.selectedIndex < 0 ) { filter_domainnameSel.selectedIndex = 0; CurrentDomainIndex = 1; // start with First } // If All else if ( filter_domainnameSel.selectedIndex == 0 ) { CurrentDomainIndex = 1; // start with first } // Specific Domain else { filter_domainname.value = AC_DomainArr[(filter_domainnameSel.selectedIndex * UserRecLength)]; } } for ( var i=AC_NameSel.length; i > 0; i-- ) { AC_NameSel.remove(0); } if ( RpmCC_AC.ComputerLookup("*","*") ) { processManageAgentContinue(); } } function processManageAgentContinue() { if ( AgentWinMain.style.display != "" ) return; if ( CurrentDomainIndex > 0 && ShowAllDomain.checked ) { if ( ++CurrentDomainIndex < AC_DomainArr.length/UserRecLength ) { var filter = processGetDomainAndFilterSpec(); if ( filter != "" ) { top.Rstatus.Pstat("Searching Windows Domain/Workgroup-"+CurrentDomainEnumerated); MomText.innerHTML = "Searching Windows Domain/Workgroup-<br><b>'"+CurrentDomainEnumerated+"'</b><br>Total Found - <b>"+(EnumeratedServersArr.length/EnumeratedServersRecLength)+"</b>"; RpmCC_AC.GetEnumeratedServers(filter); // go enumerate servers/workstations return; } } } SetCursor("auto"); top.banner.processStopCommX(); PopUpMoment.style.display = "none"; CMode = saveCMode; ELBgFlg = 0; // flag for alternating background color ELIdx = 0; // output log index var lce = ""; var AgentLCArr = new Array(); var AgentSortArr = new Array(); var warr = new Array(); var aarr = new Array(); for (var i=0, j=0; i < AC_StoreArr.length; i+=ComputerRecLength, ++j) { lce = AC_StoreArr[i].toLowerCase(); AgentLCArr[j] = lce; AgentSortArr[j] = lce+"[]"+i+"[]"+"0"+"[]"; } if ( ShowAllDomain.checked ) { var asamax = j; var stype = 0; for ( i=0; i<EnumeratedServersArr.length-1; i+= EnumeratedServersRecLength ) { // Filter out any there are not NT/2000/XP stype = parseInt( EnumeratedServersArr[i+5],16 ); if ( !(stype & SV_TYPE_NT) ) continue; // Filter out entries already in the Computer table lce = EnumeratedServersArr[i+1].toLowerCase(); for ( var k=0; k<asamax; k++ ) { if ( lce == AgentLCArr[k] ) break; } EnumeratedServersArr[i] = (EnumeratedServersArr[i] == "") ? CurrentLocalDomain : EnumeratedServersArr[i]; if ( k < asamax ) { aarr = AgentSortArr[k].split("[]"); aarr[3] = EnumeratedServersArr[i]; // Domain Name AgentSortArr[k] = aarr.join("[]"); continue; } AgentSortArr[j++] = lce+"[]"+i+"[]"+"1"+"[]"+EnumeratedServersArr[i]; } } AgentSortArr.sort(); AgentObjectArray.length = 0; // reset AgentCheckBoxObjectArray.length = 0; for (var i=0; i < AgentSortArr.length; ++i) { warr = AgentSortArr[i].split("[]"); processAgentWindowEntry(parseInt(warr[1],10),warr[2],warr[3]); } SetButtonState(RefreshButton,"0"); // enable AgentCheckedCount = 0; top.Rstatus.Pstat("Current Agent Version is: "+CurrentAgentVersion,true); } function processManageAgentResetButton() { top.Rstatus.Pstat(""); AgentWinMain.style.display="none"; DomainFilter.style.display="none"; LogonInfo.style.display = "none"; AC_GroupSel.style.display=acgs; AC_DomainNSel.style.display=acds; AC_NameSel.style.display=acns; AC_MIBSel.style.display=acms; allDeselectGroup(AC_GroupSel); // deselect all in Group ServiceSelect.style.display=""; PopUpMoment.style.display = "none"; SetCursor("auto"); top.banner.processStopCommX(); } function processSort(scode) { var warr = new Array(); var SortArr = new Array; var sparm = ""; ELBgFlg = 0; // flag for alternating background color ELIdx = 0; // output log index for (var i=0; i < AgentObjectArray.length; ++i) { if ( scode == 0 ) { sparm = AgentObjectArray[i].aver; } else if ( scode == 2 ) { sparm = (AgentObjectArray[i].tflag == "0") ? AC_StoreArr[parseInt(AgentObjectArray[i].cidx,10)+5].toLowerCase() : EnumeratedServersArr[parseInt(AgentObjectArray[i].cidx,10)+2].toLowerCase(); } else if ( scode == 3 ) { sparm = AgentObjectArray[i].ddom.toLowerCase() + ( (AgentObjectArray[i].tflag == "0") ? AC_StoreArr[parseInt(AgentObjectArray[i].cidx,10)].toLowerCase() : EnumeratedServersArr[parseInt(AgentObjectArray[i].cidx,10)+1].toLowerCase() ); } else { sparm = (AgentObjectArray[i].tflag == "0") ? AC_StoreArr[parseInt(AgentObjectArray[i].cidx,10)].toLowerCase() : EnumeratedServersArr[parseInt(AgentObjectArray[i].cidx,10)+1].toLowerCase(); } SortArr[i] = sparm+"???"+AgentObjectArray[i].cidx+"???"+AgentObjectArray[i].tflag+"???"+AgentObjectArray[i].pdom; } SortArr.sort(); AgentText.innerHTML = ""; AgentObjectArray.length = 0; // reset AgentCheckBoxObjectArray.length = 0; for (var i=0; i < SortArr.length; ++i) { warr = SortArr[i].split("???"); processAgentWindowEntry(parseInt(warr[1],10),warr[2],warr[3]); } } function processAgentWindow() { /* Format Output to Log Window */ AgentWin.innerHTML = AgentWinInit; FOps = "<table id='agnthdr' border='0' cellpadding='1' cellSpacing='1' width='100%'><tr>"; FOps += "<td width='4%' align='center' style='background-color:activeborder' class='optextb'>"; FOps += "I/U" + "</td>"; FOps += "<td width='6%' align='center' style='background-color:activeborder' class='optextb'>"; FOps += "Status" + "</td>"; FOps += "<td width='10%' align='center' title='Sort by Agent version' onclick='processSort(0)' style='background-color:activeborder; cursor:hand' class='optextb'>"; FOps += "Version" + "</td>"; FOps += "<td width='23%' align='center' title='Sort by Name' onclick='processSort(1)' style='background-color:activeborder; cursor:hand' class='optextb'>"; FOps += "Name" + "</td>"; FOps += "<td width='15%' align='center' title='Sort by IP Address' onclick='processSort(2)' style='background-color:activeborder; cursor:hand' class='optextb'>"; FOps += "IP Address" + "</td>"; FOps += "<td width='15%' align='center' title='Sort by Domain' onclick='processSort(3)' style='background-color:activeborder; cursor:hand' class='optextb'>"; FOps += "Domain" + "</td>"; FOps += "<td width='*' align='center' style='background-color:activeborder' class='optextb'>"; FOps += "Path" + "</td>"; FOps += "</tr></table>"; AgentWin.insertAdjacentHTML("afterBegin",FOps); } var AgentObjectArray = new Array(); var AgentCheckBoxObjectArray = new Array(); var AgentCheckedCount = 0; function processAgentWindowEntry(cidx,tflag,domname) { if ( tflag == "0" ) { // if in Computer table var warr = new Array(); warr = AC_StoreArr[cidx+9].split(" "); warr = warr[0].split(";"); aversion = warr[0]; aversion = (aversion.length > 15) ? "" : aversion; } else { aversion = ""; } // Determine Domain Array index to get Login Info later var deflag = 0; var enumdomain = ""; var pdomain = domname; if ( tflag == "0" ) { if ( AC_StoreArr[cidx+10] != "" ) { if ( AC_StoreArr[cidx+10].toLowerCase() != domname.toLowerCase() ) { deflag = ( domname == "" ) ? 1 : 2; enumdomain = domname; } domname = AC_StoreArr[cidx+10]; } else if ( domname == "" ) { return; // ignore any with no Domain designation in the database and none enumerated } } var daidx=0; for ( var i=0; i<AC_DomainArr.length; i+=UserRecLength ) { if ( domname == AC_DomainArr[i] ) { daidx = i; break; } } aipath = CreateAIPath( ((tflag == "0") ? AC_StoreArr[cidx+0] : EnumeratedServersArr[cidx+1]) ); var ddom = (tflag == "0") ? domname.toLowerCase() : EnumeratedServersArr[cidx].toLowerCase(); FOps = "<div id='agentrow" + ELIdx + "' apath='" + aipath + "' pdom='" + pdomain + "' aver='" + aversion + "' ddom='" + ddom +"' cidx='" + cidx + "' daidx='" + daidx +"' tflag='" + tflag; if ((ELBgFlg ^= 1) == 0) { FOps += "' style='background-color:white;"; } else { FOps += "' style='background-color:e8e8e8;"; } FOps += "'>"; FOps += "<table border='0' cellpadding='1' cellSpacing='1' width='100%'><tr>"; FOps += "<td width='4%' align='center' class='optext'>"; FOps += "<input onclick='processAgentCheckClick()' id='agnt" + ELIdx + "' type='checkbox'></td>"; FOps += "<td width='6%' style='cursor:hand' class='optext' id='astat" + ELIdx + "'>"; FOps += "</td>"; FOps += "<td width='10%' class='optext'>"; FOps += aversion + "</td>"; FOps += "<td width='23%' style='fontFamily:arial' title='"+((tflag == "0") ? AC_StoreArr[cidx+2] : EnumeratedServersArr[cidx+6])+"' class='optext'>"; FOps += ((tflag == "0") ? AC_StoreArr[cidx+0] : "<b>"+EnumeratedServersArr[cidx+1]+"</b>") + "</td>"; FOps += "<td width='15%' style='fontFamily:arial' class='optext'>"; FOps += ((tflag == "0") ? AC_StoreArr[cidx+5] : "<b>"+EnumeratedServersArr[cidx+2]+"</b>") + "</td>"; FOps += "<td width='15%' style='fontFamily:arial' class='optext' "; if ( deflag == 1 && ShowAllDomain.checked) { FOps += "style='color:orange; cursor:hand' title='Defined in database with this Domain but not found when enumerating servers'"; } else if ( deflag == 2 && ShowAllDomain.checked) { FOps += "style='color:red; cursor:hand' title='Defined in database with this Domain but found in `"+enumdomain+"` when enumerating servers' "; } else if ( tflag != "0" ) { FOps += "style='cursor:hand' title='Not defined in database but found in `"+EnumeratedServersArr[cidx].toUpperCase()+"` when enumerating servers' "; } FOps += ">"+((tflag == "0") ? domname.toLowerCase() : "<b>"+EnumeratedServersArr[cidx].toLowerCase()+"</b>") + "</td>"; FOps += "<td width='*' style='cursor:hand' title='Click Path to Edit' onclick='processAgentPathClick(" + ELIdx + ")' class='optext' id='apathspec" + ELIdx + "'>"; FOps += ((tflag == "0") ? aipath : "<b>"+aipath+"</b>") + "</td>"; FOps += "</tr></table></div>"; AgentText.insertAdjacentHTML("beforeEnd",FOps); AgentObjectArray[ELIdx] = document.all["agentrow"+ELIdx]; AgentCheckBoxObjectArray[ELIdx] = document.all["agnt"+ELIdx]; ++ELIdx; // bump index count } var GlobalAgentPathIndex = 0; function processAgentPathClick(pindx) { if ( GlobalAIP ) return; // exit if busy GlobalAIP = true; SetButtonState(OKButtonAIP,"0"); // enable SetButtonState(CancelButtonAIP,"0"); GlobalAgentPathIndex = pindx; PopUpAI.style.display=""; SetDefaultPath.checked = ""; DefaultPathCheckbox.style.display = ""; AIPath.value = AgentObjectArray[pindx].apath; } function processGlobalAgentPath() { AgentObjectArray[GlobalAgentPathIndex].apath = AIPath.value; document.all["apathspec"+GlobalAgentPathIndex].innerText = AIPath.value; GlobalAIP = false; PopUpAI.style.display="none"; if ( SetDefaultPath.checked ) { var ndx = AIPath.value.indexOf("\\",2); //" var bastrg = AIPath.value.substring(ndx, AIPath.value.length); var wstrg = ""; for ( var i=0; i<AgentObjectArray.length; i++ ) { ndx = AgentObjectArray[i].apath.indexOf("\\",2); //" wstrg = AgentObjectArray[i].apath.substring(0,ndx); wstrg += bastrg; AgentObjectArray[i].apath = wstrg; document.all["apathspec"+i].innerText = wstrg; } } } function processSelect(Pflg) { for ( var i=0; i<AgentCheckBoxObjectArray.length; i++ ) { AgentCheckBoxObjectArray[i].checked = (Pflg == "1") ? "" : "checked"; } AgentCheckedCount = (Pflg == "1") ? 0 : AgentCheckBoxObjectArray.length; if ( AgentCheckedCount == 0 ) { SetButtonState(GlobalInstallAgentButton,"1"); } else { SetButtonState(GlobalInstallAgentButton,"0"); } } function processAgentCheckClick() { if ( document.all[event.srcElement.id].checked == "" ) { --AgentCheckedCount; } else { ++AgentCheckedCount; } if ( AgentCheckedCount == 0 ) { SetButtonState(GlobalInstallAgentButton,"1"); } else { SetButtonState(GlobalInstallAgentButton,"0"); } } var AIndx = 0; var GlobalAIP = false; var AgentCancel = false; function processGlobalInstallAgentButton() { if ( AgentCheckedCount == 0 ) { alert("Please select one or more servers/workstations where you want the Agent installed!"); } else if ( confirm("Are you sure you want to install the Agent on the selected servers/workstations?\n-Have you specified Administrator 'Logon' credentials?") ) { // Determine Count of Checked Servers Not Currently in the Database for ( var i=0, acount=0; i<AgentCheckBoxObjectArray.length; i++ ) { if ( AgentCheckBoxObjectArray[i].checked && AgentObjectArray[i].tflag == "1" ) { ++acount; } } if ( acount > (LicenseMax-LicenseCur) ) { alert("You have selected "+acount+" new servers/workstations to install the Agent.\nHowever, you only have "+(LicenseMax-LicenseCur)+" license(s) available for new servers/workstations!\n-Adjust the number of new servers/workstations selected"); return; } AIndx = 0; GlobalAIP = true; AgentCancel = false; SetButtonState(GlobalInstallAgentButton,"1"); // disable SetButtonState(AgentCancelButton,"0"); // enable SetButtonState(AgentDoneButton,"1"); // disable processGlobalInstallAgentContinue(); } } var rescol = "white"; function processGlobalInstallAgentContinue() { for ( ; AIndx < AgentCheckBoxObjectArray.length && !AgentCancel; ++AIndx ) { if ( AgentCheckBoxObjectArray[AIndx].checked ) { var Cindx = parseInt( AgentObjectArray[AIndx].cidx,10 ); var DAindex = parseInt( AgentObjectArray[AIndx].daidx,10 ); var tflag = AgentObjectArray[AIndx].tflag; AI_arg = AgentObjectArray[AIndx].apath+"~"+((tflag == "0") ? AC_StoreArr[Cindx+5] : EnumeratedServersArr[Cindx+2])+"~"; if ( AC_DomainArr.length == 0 ) { AI_arg += logon_username.value+"~"+logon_password.value+"~"+logon_domainname.value+"~"; } else { // Look for match on server/workstation name and a Domain name which is also a 'stand-alone' for ( var i=0; i<AC_DomainArr.length; i+=UserRecLength ) { if ( AC_DomainArr[i+5] == "3" && AC_DomainArr[i].toLowerCase() == ((tflag == "0") ? AC_StoreArr[Cindx] : EnumeratedServersArr[Cindx+1]).toLowerCase() ) { AI_arg += AC_DomainArr[i+4]+"~" +AC_DomainArr[i+3]+"~"+AC_DomainArr[i]+"~"; break; } } if ( i >= AC_DomainArr.length ) { // Check if any credentials provided for matched Doamin if ( AC_DomainArr[DAindex+4].length > 0 ) { AI_arg += AC_DomainArr[DAindex+4]+"~"+AC_DomainArr[DAindex+3]+"~"; } else { // otherwise use <All> credentials if any for the matched Domain AI_arg += AC_DomainArr[4]+"~"+AC_DomainArr[3]+"~"; } AI_arg += ( (DAindex == 0) ? "" : AC_DomainArr[DAindex] )+"~"; } } // Expand the string to force it to be compressed (and by implication, 'encypted') while ( AI_arg.length < 512 ) { AI_arg += AI_arg; } if ( RpmCC_AC.AgentInstall( AI_arg ) ) { var Lstatstrg = "<img src='images/reset.gif' align='absmiddle' height='15' title='Unable to initiate the Agent Install/Update' width='15'>"; document.all["astat"+AIndx].innerHTML = Lstatstrg; } else { // waiting for OperationCompleteEvent rescol = ((AIndx % 2) == 0 ) ? "e8e8e8" : "white"; AgentObjectArray[AIndx].style.backgroundColor = "scrollbar"; SetCursor("wait"); top.banner.processStartComm(); top.Rstatus.Pstat("Agent Install/Update proceeding on "+((tflag == "0") ? AC_StoreArr[Cindx] : EnumeratedServersArr[Cindx+1]),true); return; } } } GlobalAIP = false; SetButtonState(GlobalInstallAgentButton,"0"); SetButtonState(AgentCancelButton,"1"); SetButtonState(AgentDoneButton,"0"); // enable if ( AgentCancel ) { alert("Agent Install/Update Canceled. Consult the Status column for results of those completed!"); } else { alert("Done Agent Install/Update. Consult the Status column for results!\nHover with mouse over status icon for status text."); } top.Rstatus.Pstat("Done"); } function processAgentCancelButton() { AgentCancel = true; SetButtonState(AgentCancelButton,"1"); } function processResetButton() { IPLookupButton.style.display = "none"; AdminGroupButton.style.display = ""; ConfigAlertButton.style.display = ""; // if Edit mode just finish up Edit without updating store if ( CMode == "Edit" ) { processEditComplete(true); return; } SetButtonState(VerifyButton,"1"); var saveMode = CMode; PopUpDiv.style.display="none"; AddServicesFlag = 0; // reset ELogWinMain.style.display="none"; MonServerRow0.style.visibility = "hidden"; MonServerRow1.style.visibility = "hidden"; viewToggle = 0; MonServerButton.style.display = "none"; processResetDone(); if ( saveMode == "New" ) { allGrpSelected = true; processLookupButton(); } SetCursor("auto"); top.banner.processStopCommX(); } function processUpdateButton() { /* get input which is validated when first entered */ if ( processServiceSelectGet() == false ) // if invalid input return; processServiceSelectPut(); // get cuurent selected Service parameters CName = AC_Name.value; CGrpID = getGroupID(AC_Group.value,AC_GrpStore); CPswd = AC_Pswd.value; CDesc = AC_Desc.value; var darr = new Array(); darr = CDesc.split("'"); CDesc = darr.join("`"); CDesc += " DOMAIN="+AC_DomainNSel.options[AC_DomainNSel.selectedIndex].value; var SNMPflag = (AC_SNMPEnabled.checked) ? "1" : "0"; var MIBObjects = createMIBObjectArray(); if (SNMPflag == "1" && MIBObjects == "") { // if no MIB Objects selected top.Rstatus.Pstat("Please select one or more MIB Objects, or disable SNMP",true); alert("You have enabled SNMP but have not selected at least one MIB Object to include for monitoring!\n\nPlease select one or more MIB Objects or disable SNMP monitoring!"); processGeneralClick(SNMPTab); return; } if ( SNMPflag == "0" ) { MIBObjects = ""; for ( var i=0; i<MIBObjectArr.length; i++ ) { MIBObjectCheckArr[i] = "0"; } AC_MIBSel.length = 0; } CDesc += " SNMPINFO="+SNMPflag+":!"+MIBObjects+":!"+AC_ReadComm.value+":!"+AC_SNMPPort.value+":!"+AC_Collection.value; AC_DomainN.value = AC_DomainNSel.options[AC_DomainNSel.selectedIndex].value; CIP = AC_IPAddr.value; CPort = AC_Port.value; CSrvID = getServerID(AC_Server.value); if (CName.length == 0) { // if no name entered top.Rstatus.Pstat("Please enter a name",true); alert("Please enter a name"); AC_Name.focus(); } else if (CPswd != AC_VPswd.value) { top.Rstatus.Pstat("Verify Password Does Not Match Password, please reenter both",true); alert("Verify Password Does Not Match Password, please reenter both"); AC_Pswd.focus(); } else { if ( CPswd != "" ) { if ( !confirm("Are you sure you want to define an Agent Password?\n -You will have to define this same Password at\nthe Agent, which it will use to authenticate and\nsuccessfully connect to the MonitorIT Server.\n\nPress OK to accept the Password!\nPress Cancel to go back to edit!") ) { AC_Pswd.focus(); return; } } /* inhibit Verify, Update and Reset Buttons now */ SetButtonState(CUpdateButton,"1"); SetButtonState(CResetButton,"1"); SetButtonState(VerifyButton,"1"); SetButtonState(InstallAgentButton,"1"); AdminGroupButton.style.display = ""; ConfigAlertButton.style.display = ""; /* Determine if CMode is "New" or "Edit" and send data to DataBase Server appropriately */ if (CMode == "New") { // Initialize additional "New" parameters COSver = "Unknown"; CMonStart = ""; CMonStop = ""; CMonSched = 251658496; CDlvStart = ""; CDlvStop = ""; CDlvSched = 16843008; rstat = RpmCC_AC.ComputerAdd(CName,CGrpID,CSrvID,CPswd,CDesc,CIP,CPort,COSver,CMonStart,CMonStop,CMonSched,CDlvStart,CDlvStop,CDlvSched); LastNew = CName; } else { // "Edit" OrigCName = AC_NameSel.options[CurSelectIdx].text; // Selected Computer Name is Original Computer Name rstat = RpmCC_AC.ComputerReplace(OrigCName,CName,CGrpID,CSrvID,CPswd,CDesc,CIP,CPort); } if ( rstat ) { // if unable to initiate request top.Rstatus.Pstat("Unable to start the UPDATE request",true); processResetButton(); } else { // waiting for OperationCompleteEvent ++ignoreDBChangeEvent; top.Rstatus.Pstat("One moment while UPDATE for '"+AC_Name.value+"' completes"); } } } function processDeleteButton() { CMode = "Delete"; // set mode of operation /* ask user to confirm delete */ if ( confirm("Are you sure you want to delete: " + AC_Name.value + " ?") ) { /* inhibit Edit, Delete, and Reset Buttons now */ SetButtonState(CResetButton,"1"); SetButtonState(CEditButton,"1"); SetButtonState(CDupButton,"1"); SetButtonState(CDeleteButton,"1"); SetButtonState(WMButton,"1"); /* send DELETE request to DataBase Server */ if ( RpmCC_AC.ComputerDelete(AC_Name.value) ) { top.Rstatus.Pstat("Unable to start the DELETE request",true); processResetButton(); } else { // waiting for OperationCompleteEvent ++ignoreDBChangeEvent; SetCursor("wait"); top.banner.processStartComm(); top.Rstatus.Pstat("Moment please. Deleting a server/computer may take several minutes"); } } } function commonNew_Edit() { //Common processing for New and Edit /* enable input fields */ AC_GroupSel.className = ""; AC_Pswd.className = ""; AC_VPswd.className = ""; AC_Desc.className = ""; AC_IPAddr.className = ""; AC_Port.className = ""; AC_Server.className = ""; AC_DomainNSel.className = ""; /* enable and disable appropriate buttons */ SetButtonState(CNewButton,"1"); SetButtonState(CEditButton,"1"); SetButtonState(CDupButton,"1"); SetButtonState(CDeleteButton,"1"); SetButtonState(WMButton,"1"); SetButtonState(CUpdateButton,"0"); SetButtonState(CResetButton,"0"); SetButtonState(LogonButtonOnTab,"0"); SetButtonState(InstallAgentButton,"0"); IAText.innerText = ( AC_OSver.value == "" || AC_OSver.value == "Unknown" ) ? "Install" : "Update"; /* enable appropriate Computer and Group Name fields */ AC_Name.style.display = ""; AC_NameSel.style.display = "none"; AC_Name.focus(); AC_Group.style.display = "none"; AC_GroupSel.style.display = ""; AC_Server.style.display = "none"; if ( viewToggle == 1 ) { AC_ServerSel.style.display = ""; } AC_SNMPEnabled.className = ""; AC_SNMPEnabled.disabled = ""; if ( AC_SNMPEnabled.checked ) { if ( GotMIBData ) { SetButtonState(MIBObjectButton,"0"); } AC_MIBSel.className = ""; AC_ReadComm.className = ""; AC_SNMPPort.className = ""; AC_Collection.className = ""; } var lth = AC_DomainNSel.length; for (i=0; i < lth; ++i) AC_DomainNSel.remove(0); addElementToSelect(AC_DomainNSel,""); for ( var i=UserRecLength; i<AC_DomainArr.length; i+=UserRecLength ) { if ( AC_DomainArr[i+5] != "3" ) { addDomainElementToSelect(AC_DomainNSel,AC_DomainArr[i]+DtypTxt[parseInt(AC_DomainArr[i+5],10)],AC_DomainArr[i]); } } AC_DomainNSel.selectedIndex = 0; for ( var i=0; i<AC_DomainNSel.length; i++ ) { if ( AC_DomainNSel.options[i].value == AC_DomainN.value ) { AC_DomainNSel.selectedIndex = i; break; } } AC_DomainN.style.display = "none"; AC_DomainNSel.style.display = ""; IPLookupButton.style.display = ""; //MonServerButton.style.display = ""; AdminGroupButton.style.display = "none"; ConfigAlertButton.style.display = "none"; /* enable checkboxes */ genchk.disabled = genchk.className = ""; processServiceSelectPut(); ServiceSelect.className = ""; AC_GroupSel.multiple = ""; AC_GroupSel.size = "1"; allDeselectGroup(AC_GroupSel); // deselect all in Group } function addDomainElementToSelect(SelectObj,text,value) { var el = document.createElement("OPTION"); el.text = text; el.value = value; SelectObj.options.add(el); return el; } // Enable IP Address Lookup Window Pop-up Window function processIPLookupButton() { SetButtonState(OKButtonDL,"0"); // enable SetButtonState(CancelButtonDL,"0"); SetButtonState(CUpdateButton,"1"); SetButtonState(CResetButton,"1"); SetButtonState(DiscoveryButton,"1"); SetButtonState(VerifyButton,"1"); SetButtonState(InstallAgentButton,"1"); SetButtonState(ManageAgentsButton,"1"); AC_DomainNSel.style.display="none"; PopUpDomain.style.display=""; DomainToLookup.value = AC_Name.value; // populate with Computer Name } function processIPLookupCancelButton() { SetButtonState(CUpdateButton,"0"); SetButtonState(CResetButton,"0"); SetButtonState(VerifyButton,"0"); SetButtonState(InstallAgentButton,"0"); SetButtonState(ManageAgentsButton,"0"); if ( CMode == "New" ) { SetButtonState(DiscoveryButton,"0"); } PopUpDomain.style.display="none"; // disable pop-up AC_DomainNSel.style.display=""; } function processIPLookupOKButton() { SetButtonState(OKButtonDL,"1"); // disable SetButtonState(CancelButtonDL,"1"); AC_IPAddr.value = RpmMIL.ResolveNameToIPAddr(DomainToLookup.value); processIPLookupCancelButton(); // reset } /* Process Combo Computer Name Change Event */ function processComputerName() { Nobj = AC_NameSel; // get object for (i=0; i < Nobj.length; ++i) { if ( Nobj.options[i].selected ) { CurSelectIdx = i; populateInput(ComputerRecLength*i); break; } } } /* Process Combo Group Name Change Event */ function processGroupName() { Nobj = AC_GroupSel; // get object if (Nobj.multiple == "") { // single mode for (i=0; i < Nobj.length; ++i) { if ( Nobj.options[i].selected ) { GrpSelectIdx = i; // Synchronize Group name field with Combo name field AC_Group.value = Nobj.options[i].text; break; } } } } var CurrentSelectedComputer = 0; function populateInput(idx) { CurrentSelectedComputer = idx; // Synchronize name field with Combo name field AC_Name.value = AC_StoreArr[idx+0]; // Set rest of input fields AC_Group.value = getGroupName(AC_StoreArr[idx+1],AC_GroupSel,AC_GrpStore); AC_Desc.value = AC_StoreArr[idx+2]; AC_Pswd.value = AC_StoreArr[idx+3]; AC_VPswd.value = AC_Pswd.value; AC_OSver.value = AC_StoreArr[idx+4]; AC_IPAddr.value = AC_StoreArr[idx+5]; AC_Port.value = AC_StoreArr[idx+6]; AC_Server.value = getServerName(AC_StoreArr[idx+8]); AC_AgentVer.value = AC_StoreArr[idx+9]; AC_DomainN.value = AC_StoreArr[idx+10]; var sarr = new Array(); sarr = AC_StoreArr[idx+11].split(":!"); AC_SNMPEnabled.checked = (sarr[0] =="1") ? "checked" : ""; //Reset Object checked array for ( var i=0; i<MIBObjectArr.length; i++ ) { MIBObjectCheckArr[i] = "0"; } if ( sarr.length >= 5 ) { AC_ReadComm.value = sarr[2]; AC_SNMPPort.value = sarr[3]; AC_Collection.value = sarr[4]; var sarr1 = new Array(); sarr1 = sarr[1].split(";!"); // Now set the appropriate ones for ( var i=0; i<sarr1.length; i++ ) { for ( var j=1; j<MIBObjectArr.length-1; j++ ) { if ( sarr1[i] == MIBObjectArr[j] ) { MIBObjectCheckArr[j] = "1"; break; } } } } if ( CurSelTab == "SNMPTab" ) { displayMIBObjectChoices(); AC_MIBSel.style.visibility="visible"; } else { AC_MIBSel.style.visibility="hidden"; } rqstin.style.visibility="hidden"; respin.style.visibility="hidden"; sqlsrv.style.visibility="hidden"; sqlusr.style.visibility="hidden"; var warr = new Array(); var warr1 = new Array(); var pv = 0; resetServiceFields(); // initialize Service fields var cid = AC_StoreArr[idx+7]; // Computer ID var ssi = ServiceTypeCount; // preset for last Service for ( var i=0, j=-1; i<AC_ServicesStoreArr.length; i+=ServicesRecLength ) { if ( AC_ServicesStoreArr[i] == cid ) { // match on Computer ID if ( AC_ServicesStoreArr[i+1] == "" ) { // if null entry continue; // loop to next } warr = AC_ServicesStoreArr[i+1].split("~"); // get Services Record parameters genchk.checked = "checked"; gento.value = warr[4]; genret.value = warr[5]; if ( (pv = parseInt(warr[6],10)) > 0x10000 ) { genport.value = "" + (pv-0x10000); securechk.checked = "checked"; } else { genport.value = warr[6]; securechk.checked = ""; } genname.value = warr[12]; genrqst.value = warr[13]; genresp.value = warr[14]; if ( warr[3] == "AGENT" ) { continue; } else if ( warr[3] == "PING" ) { j = 0; } else if ( warr[3] == "HTTP" ) { j = 1; rqstin.style.visibility="visible"; genname.value = warr[14]; respin.style.visibility="visible"; // parse out the leading "/" genresp.value = warr[13].substring(1,warr[13].length); } else if ( warr[3] == "FTP" ) { j = 2; } else if ( warr[3] == "SMTP" ) { j = 3; } else if ( warr[3] == "POP" ) { j = 4; } else if ( warr[3] == "DNS" ) { j = 5; rqstin.style.visibility="visible"; } else if ( warr[3] == "USER" ) { j = 6; rqstin.style.visibility="visible"; respin.style.visibility="visible";} else if ( warr[3] == "SQLCONNECT" ) { j = 7; rqstin.style.visibility="visible"; respin.style.visibility="visible"; sqlsrv.style.visibility="visible"; sqlusr.style.visibility="visible"; warr1 = genrqst.value.split(","); genrqst.value = warr1[3]; genresp.value = warr1[2]; sqlsrvnme.value = warr1[0]; sqlusrnme.value = warr1[1]; } else if ( warr[3] == "SNMP" ) { j = 8; rqstin.style.visibility="visible"; respin.style.visibility="visible"; warr1 = genrqst.value.split(","); genrqst.value = warr1[0]; genresp.value = warr1[1]; sqlsrvnme.value = (warr1.length >= 4) ? warr1[3] : ""; sqlusrnme.value = (warr1.length >= 5) ? warr1[4] : ""; } else if ( warr[3] == "TELNET" ) { j = 9; } else if ( warr[3] == "ORACLE" ) { j = 10; rqstin.style.visibility="visible"; respin.style.visibility="visible"; sqlsrv.style.visibility="visible"; sqlusr.style.visibility="visible"; warr1 = genrqst.value.split(","); genrqst.value = warr1[3]; genresp.value = warr1[2]; sqlsrvnme.value = warr1[0]; sqlusrnme.value = warr1[1]; } else if ( warr[3] == "L_NOTES" ) { j = 11; rqstin.style.visibility="visible"; respin.style.visibility="visible"; } prevServiceSelectIndex = j; processServiceSelectGet(); if ( j < ssi ) { ssi = ServiceSelect.selectedIndex = j; // set the selected one } } } if ( j == -1 ) { // if no services, default to show PING ServiceSelect.selectedIndex = 0; // set the selected one } processServiceSelectPut(); // make sure all required fields are visible if ( AC_OSver.value == "" || AC_OSver.value == "Unknown" ) { IAText.innerText = "Install"; SetButtonState(HWInfoButton,"1"); } else { IAText.innerText = "Update"; SetButtonState(HWInfoButton,"0"); } } function updateStore(idx) { AC_NameSel.options[idx].text = AC_Name.value; // get name in case edited si = ComputerRecLength * idx; // index into Store for correct entry AC_StoreArr[si+0] = AC_Name.value; AC_StoreArr[si+1] = getGroupID(AC_Group.value,AC_GrpStore); AC_StoreArr[si+2] = (AC_Desc.value.length == 0) ? "" : AC_Desc.value; AC_StoreArr[si+3] = (AC_Pswd.value.length == 0) ? "" : AC_Pswd.value; AC_StoreArr[si+4] = (AC_OSver.value.length == 0) ? "" : AC_OSver.value; AC_StoreArr[si+5] = (AC_IPAddr.value.length == 0) ? "" : AC_IPAddr.value; AC_StoreArr[si+6] = (AC_Port.value.length == 0) ? "" : AC_Port.value; AC_StoreArr[si+8] = getServerID(AC_Server.value); AC_StoreArr[si+9] = (AC_AgentVer.value.length == 0) ? "" : AC_AgentVer.value; AC_StoreArr[si+10] = AC_DomainNSel.options[AC_DomainNSel.selectedIndex].value; var SNMPflag = (AC_SNMPEnabled.checked) ? "1" : "0"; var MIBObjects = createMIBObjectArray(); AC_StoreArr[si+11] = SNMPflag+":!"+MIBObjects+":!"+AC_ReadComm.value+":!"+AC_SNMPPort.value+":!"+AC_Collection.value; } /* Process Computer OP Complete Event */ function processComputerOpComplete() { var SAstrg = null; var warr = new Array(); if (CMode == "Lookup") { if (LupRecCount == 0) { // check if any records found top.Rstatus.Pstat("No record matches found for LOOKUP request",true); processResetButton(); // reset SetButtonState(CEditButton,"1"); SetButtonState(CDupButton,"1"); SetButtonState(CDeleteButton,"1"); } else { ServicesRecCount = 0; // reset count rstat = RpmCC_AC.ServicesLookup("","","ComputerID,ID DESC"); if ( rstat ) { // if unable to initiate request top.Rstatus.Pstat("Unable to start the Services LOOKUP request",true); processResetButton(); } else { // waiting for OperationCompleteEvent top.Rstatus.Pstat("One moment while Services LOOKUP request completes"); } } } else if (CMode == "Lookup_DiscoveryAdd") { processAddServicesContinue(); } else if (CMode == "Lookup_ManageAgent") { if ( ShowAllDomain.checked ) { var filter = processGetDomainAndFilterSpec(); if ( filter == "" ) { processManageAgentContinue(); } else { top.Rstatus.Pstat("Searching Windows Domain/Workgroup-"+CurrentDomainEnumerated); MomText.innerHTML = "Searching Windows Domain/Workgroup-<br><b>'"+CurrentDomainEnumerated+"'</b><br>Total Found - <b>0</b>"; RpmCC_AC.GetEnumeratedServers(filter); // go enumerate servers/workstations } } else { processManageAgentContinue(); } } else if (CMode == "Edit") { var idx = ComputerRecLength*CurSelectIdx; // index to computer record beig edited ServEditCID = AC_StoreArr[idx+7]; // Computer ID being edited // Find index into Store for the Services for this Computer for ( var i=0; i<AC_ServicesStoreArr.length; i+=ServicesRecLength ) { if ( AC_ServicesStoreArr[i] == ServEditCID ) { // match on Computer ID break; // if found } } if ( i >= AC_ServicesStoreArr.length ) { // if not found var j = i; do { // create a null set of service entries for this Comp ID AC_ServicesStoreArr[j++] = ServEditCID; // Computer ID AC_ServicesStoreArr[j++] = ""; ++ServicesRecCount; // bump record counter } while ( (ServicesRecCount % ServiceTypeCount) != 0 ) } // Start with Update to PING Service, then exit; ServiceOpComplete handles the rest ServStorIdx = i; // set index to start of Service Records for this Computer ServEditCount = 0; // initialize count //RpmCC_AC.StartStopServicesCheck("0"); // Stop Service Check Threads //ServicesCheckingStopped = true; processServiceEditUpdate("PING",tpingchk,tpingto,tpingret,"","","","",""); } else if (CMode == "Delete") { var idx = ComputerRecLength*CurSelectIdx; // index to computer record to be deleted CompDeleteID = AC_StoreArr[idx+7]; // Computer ID /* Remove computer entry from the Storage */ for (i=idx+ComputerRecLength; i < AC_StoreArr.length; ++i, ++idx) { AC_StoreArr[idx] = AC_StoreArr[i]; } AC_StoreArr.length -= ComputerRecLength; AC_NameSel.remove(CurSelectIdx); // Now delete the Services record from Store var warr = new Array(); // Find index into Store for the Services for this Computer var ServicesIncr = ServiceTypeCount * ServicesRecLength; for ( var i=0; i<AC_ServicesStoreArr.length; i+=ServicesIncr ) { if ( AC_ServicesStoreArr[i] == CompDeleteID ) { for (var j=i+ServicesIncr; j < AC_ServicesStoreArr.length; ++i, ++j) { AC_ServicesStoreArr[i] = AC_ServicesStoreArr[j]; } AC_ServicesStoreArr.length -= ServicesIncr; break; } } processDeleteComplete(); // finish up Delete } else { // Cmode New. Should not come here; See processComputerAddOpComplete() /* Reset for next */ processResetButton(); } } // Edit Complete Wrap-up function processEditComplete() { SetCursor("auto"); if ( arguments.length == 0 ) { /* update the Storage if not Edit reset */ updateStore(CurSelectIdx); } else { // Edit reset, disable Update and Verify button SetButtonState(VerifyButton,"1"); SetButtonState(CUpdateButton,"1"); populateInput(ComputerRecLength*CurSelectIdx); } if ( ServiceThreadToggleRequired ) { ServiceThreadToggleRequired = false; // reset } processResetDone(); } function processResetDone() { /* enable Edit, Delete, and Reset Buttons now */ SetButtonState(CResetButton,"1"); SetButtonState(CUpdateButton,"1"); SetButtonState(CEditButton,"0"); SetButtonState(CDupButton,"0"); SetButtonState(CDeleteButton,"0"); SetButtonState(CNewButton,"0"); SetButtonState(DiscoveryButton,"0"); SetButtonState(InstallAgentButton,"0"); SetButtonState(ManageAgentsButton,"0"); SetButtonState(WMButton,"0"); SetButtonState(MIBObjectButton,"1"); IPLookupButton.style.display = "none"; /* enable appropriate Computer and Group Name fields */ AC_Name.style.display = "none"; AC_NameSel.style.display = ""; AC_Group.style.display = ""; AC_GroupSel.style.display = "none"; AC_Server.style.display = ""; AC_ServerSel.style.display = "none"; AC_DomainN.style.display = ""; AC_DomainNSel.style.display = "none"; AC_SNMPEnabled.className = "idis"; AC_SNMPEnabled.disabled = "disabled"; /* disable checkboxes */ genchk.disabled = "disabled"; securechk.disabled = "disabled"; securechk.className = genchk.className = genport.className = gento.className = "idis"; genret.className = genname.className = genrqst.className = genresp.className = "idis"; sqlsrvnme.className = sqlusrnme.className = "idis"; ServiceSelect.className = "idis"; /* Select current Computer Name and give it focus */ if ( AC_NameSel.length > 0 ) { AC_NameSel.options[CurSelectIdx].selected = "selected"; if ( AC_NameSel.style.visibility != "hidden" ) { AC_NameSel.focus(); } } /* enable and disable appropriate input fields */ AC_Group.className = "idis"; AC_Pswd.className = "idis"; AC_VPswd.className = "idis"; AC_Desc.className = "idis"; AC_IPAddr.className = "idis"; AC_Port.className = "idis"; AC_Server.className = "idis"; AC_DomainN.className = "idis"; AC_MIBSel.className = "idis"; AC_SNMPPort.className = "idis"; AC_ReadComm.className = "idis"; AC_Collection.className = "idis"; CMode = ""; // reset } // Delete Complete Wrap-up function processDeleteComplete() { top.Rstatus.Pstat("Request Completed"); SetCursor("auto"); top.banner.processStopCommX(); if (AC_NameSel.length == 0) { // if no more computers processResetButton(); for ( var i=0; i<MIBObjectArr.length; i++ ) { MIBObjectCheckArr[i] = "0"; } AC_MIBSel.length = 0; AC_SNMPPort.value = "161"; AC_ReadComm.value = "public"; AC_Name.value = ""; AC_Group.value = ""; AC_Pswd.value = ""; AC_VPswd.value = ""; AC_Desc.value = ""; AC_IPAddr.value = ""; AC_Server.value = ""; AC_DomainN.value = ""; AC_OSver.value = ""; AC_AgentVer.value = ""; SetButtonState(CDeleteButton,"1"); SetButtonState(CEditButton,"1"); SetButtonState(CDupButton,"1"); } else { CurSelectIdx = 0; // reset select index to 1st entry populateInput(0); // adjust input fields /* Select 1st Computer Name and give it focus */ AC_NameSel.options[0].selected = "selected"; if ( AC_NameSel.style.visibility != "hidden" ) { AC_NameSel.focus(); } /* enable Edit, Delete, and Reset Buttons now */ SetButtonState(CDeleteButton,"0"); SetButtonState(CEditButton,"0"); SetButtonState(CDupButton,"0"); SetButtonState(CNewButton,"0"); SetButtonState(WMButton,"0"); } } /* Do the Part 2, Services Add */ function processComputerAddOpComplete(cid) { if ( cid == "" ) { return; } ++TotalComputersAdded; // bump count var cnt = 0; // track count of Services var SAstrg = cid; // init string with Computer ID if ( tpingchk ) { ++cnt; // bump Services count SAstrg += "~~PING" + "~" + tpingto + "~" + tpingret + "~~~~~"; } if ( thttpchk ) { ++cnt; // bump Services count SAstrg += "~~HTTP" + "~" + thttpto + "~~" + ((thttpsec) ? ""+(parseInt(thttpport,10) + 0x10000) : thttpport ) + "~~"+thttponpage+"~"+thttplookfor+"~"; } if ( tftpchk ) { ++cnt; // bump Services count SAstrg += "~~FTP" + "~" + tftpto + "~~" + ((tftpsec) ? ""+(parseInt(tftpport,10) + 0x10000) : tftpport ) + "~~~~"; } if ( tsmtpchk ) { ++cnt; // bump Services count SAstrg += "~~SMTP" + "~" + tsmtpto + "~~" + ((tsmtpsec) ? ""+(parseInt(tsmtpport,10) + 0x10000): tsmtpport ) + "~~~~"; } if ( tpopchk ) { ++cnt; // bump Services count SAstrg += "~~POP" + "~" + tpopto + "~~" + ((tpopsec) ? ""+(parseInt(tpopport,10) + 0x10000) : tpopport ) + "~~~~"; } if ( tdnschk ) { ++cnt; // bump Services count SAstrg += "~~DNS" + "~" + tdnsto + "~" + tdnsret + "~" + tdnsport + "~" + tdnsname + "~~~"; } if ( tuserchk ) { ++cnt; // bump Services count SAstrg += "~~USER" + "~" + tuserto + "~" + tuserret + "~" + tuserport + "~~" + tuserrqst + "~" + tuserresp + "~1"; } if ( tsqlchk ) { ++cnt; // bump Services count SAstrg += "~~SQLCONNECT" + "~" + tsqlto + "~~~~" + tsqlparms + "~~"; } if ( tsnmpchk ) { ++cnt; // bump Services count SAstrg += "~~SNMP" + "~" + tsnmpto + "~" + tsnmpret + "~0~~" + tsnmpparms + "~~"; } if ( ttelchk ) { ++cnt; // bump Services count SAstrg += "~~TELNET" + "~" + ttelto + "~~" + ((ttelsec) ? ""+(parseInt(ttelport,10) + 0x10000) : ttelport ) + "~~~~"; } if ( toraclechk ) { ++cnt; // bump Services count SAstrg += "~~ORACLE" + "~" + toracleto + "~~~~" + toracleparms + "~~"; } if ( tlnoteschk ) { ++cnt; // bump Services count SAstrg += "~~L_NOTES" + "~" + tlnotesto + "~" + tlnotesret + "~" + tlnotesport + "~~" + tlnotesrqst + "~" + tlnotesresp + "~1"; } if ( cnt > 0 ) { // if some Service to add rstat = RpmCC_AC.ServicesAdd(SAstrg); if ( rstat ) { // if unable to initiate request top.Rstatus.Pstat("Unable to start the Services UPDATE request",true); processResetButton(); } else { // waiting for OperationCompleteEvent top.Rstatus.Pstat("One moment while Services UPDATE for '"+AC_Name.value+"' completes"); } } else { // nothing to add; go reset processResetButton(); top.Rstatus.Pstat("Done! "+TotalComputersAdded+" computer(s) added"); ckQuickStartdone(); // check if QuickStart, and put upmessage box if so } } function ckQuickStartdone() { if ( top.QuickStartProcessing ) { alert("When finished, exit this 'Administer Servers/Computers' screen and continue with the 'QuickStart' steps screen. Next, you will define the Watches/Alerts for these newly added Servers/Computers"); top.QuickStartProcessing = false; } } // Prcoess Services Add Operation Complete Event function processServicesAddOpComplete(SrvcID) { if ( ServEditMode != "Add" || SrvcID == "" ) { return; // exit and ignore } AC_ServicesStoreArr[FStorIdx] = SrvcID + "~"+ ServAddStrg; // update Store } // Prcoess Services Operation Complete Event function processServicesOpComplete() { if (CMode == "Lookup") { var i = ServicesRecCount * ServicesRecLength; while ( (ServicesRecCount % ServiceTypeCount) != 0 ) { // round out previous AC_ServicesStoreArr[i++] = ServiceCompID; // Computer ID AC_ServicesStoreArr[i++] = ""; ++ServicesRecCount; // bump record counter } /* enable combo Computer Name; inhibit one-line input Computer Name */ AC_Name.style.display = "none"; AC_NameSel.style.display = ""; if ( LastNew != "" ) { for (var i=0, j=0; i < AC_StoreArr.length; i+=ComputerRecLength, ++j) { if ( AC_StoreArr[i] == LastNew ) { break; } } if ( i >= AC_StoreArr.length ) { i = j = 0; } /* populate input fields */ populateInput(i); /* Select 1st Computer Name and give it focus */ AC_NameSel.options[j].selected = "selected"; CurSelectIdx = j; LastNew = ""; // reset } else { /* populate input fields */ populateInput(0); /* Select 1st Computer Name and give it focus */ AC_NameSel.options[0].selected = "selected"; } if ( AC_NameSel.style.visibility != "hidden" ) { AC_NameSel.focus(); } /* enable Edit, Delete, and Reset Buttons now */ SetButtonState(CResetButton,"1"); SetButtonState(CNewButton,"0"); SetButtonState(CEditButton,"0"); SetButtonState(CDupButton,"0"); SetButtonState(CDeleteButton,"0"); SetButtonState(InstallAgentButton,"0"); SetButtonState(LogonButtonOnTab,"0"); SetButtonState(ManageAgentsButton,"0"); SetButtonState(WMButton,"0"); SetButtonState(DiscoveryButton,"0"); SetCursor("auto"); top.banner.processStopCommX(); top.Rstatus.Pstat("Request Completed. Number of Entries Found= "+LupRecCount+"; Current Unique= "+LicenseCur+"; Max Licenses= "+LicenseMax); //alert("Max="+LicenseMax) } else if (CMode == "Edit") { switch ( ++ServEditCount ) { case 1 : processServiceEditUpdate ("HTTP",thttpchk,thttpto,"",thttpport,"",thttponpage,thttplookfor,thttpsec); break; case 2 : processServiceEditUpdate ("FTP",tftpchk,tftpto,"",tftpport,"","","",tftpsec); break; case 3 : processServiceEditUpdate ("SMTP",tsmtpchk,tsmtpto,"",tsmtpport,"","","",tsmtpsec); break; case 4 : processServiceEditUpdate ("POP",tpopchk,tpopto,"",tpopport,"","","","",tpopsec); break; case 5 : processServiceEditUpdate ("DNS",tdnschk,tdnsto,tdnsret,tdnsport,tdnsname,"","",""); break; case 6 : processServiceEditUpdate ("USER",tuserchk,tuserto,tuserret,tuserport,"",tuserrqst,tuserresp,""); break; case 7 : processServiceEditUpdate ("SQLCONNECT",tsqlchk,tsqlto,"","","",tsqlparms,"",""); break; case 8 : processServiceEditUpdate ("SNMP",tsnmpchk,tsnmpto,tsnmpret,"0","",tsnmpparms,"",""); break; case 9 : processServiceEditUpdate ("TELNET",ttelchk,ttelto,"",ttelport,"","","",ttelsec); break; case 10 : processServiceEditUpdate ("ORACLE",toraclechk,toracleto,"","","",toracleparms,"",""); break; case 11 : processServiceEditUpdate ("L_NOTES",tlnoteschk,tlnotesto,tlnotesret,tlnotesport,"",tlnotesrqst,tlnotesresp,""); break; case 12 : processEditComplete(); // finish up Edit top.Rstatus.Pstat("Request Completed"); break; } } else if (CMode == "New") { if ( AddServicesFlag != 0 ) { processAddComputers(); // go set up to Add next computer } else { /* Reset for next */ processResetButton(); top.Rstatus.Pstat("Done! "+TotalComputersAdded+" server(s) added"); ckQuickStartdone(); // check if QuickStart, and put upmessage box if so } } } // Process the Specified Service Update function processServiceEditUpdate(SUtype,SUchk,SUto,SUret,SUport,SUname,SUrqst,SUresp,SUsec) { var SAstrg = null; var warr = new Array(); // Check for secure port SUport = (SUsec) ? ""+(parseInt(SUport,10) + 0x10000) : SUport; // Process the Specified Service FStorIdx = ServStorIdx+1; // Index to Store for 1st of the Services' Record string for ( var i=0,j=0; i<ServiceTypeCount; i++, FStorIdx+=ServicesRecLength ) { if ( (SAstrg = AC_ServicesStoreArr[FStorIdx]) != "" ) { warr = SAstrg.split("~"); // parse the parameter string if ( warr[3] == SUtype ) // if match on type break; } else { j = (j == 0) ? FStorIdx : j; // save index to first null entry } } if ( i >= ServiceTypeCount ) { // if not found FStorIdx = j; // set index to null entry } ServEditMode = null; // init if ( SUchk == "checked" ) { // if Service now selected // if found in Store, Replace if necessary if ( (SAstrg = AC_ServicesStoreArr[FStorIdx]) != "" ) { warr = SAstrg.split("~"); // parse the parameter string // Check if something has changed if ( (warr[4] != SUto && SUto != "") || (warr[5] != SUret && SUret != "") || (warr[6] != SUport && SUport != "") || (warr[12] != SUname && SUname != "") || (warr[13] != SUrqst && (SUrqst != "" || SUtype == "HTTP")) || (warr[14] != SUresp && (SUresp != "" || SUtype == "HTTP")) ) { warr[4] = SUto; warr[5] = SUret; warr[6] = SUport; warr[12] = SUname; // replace values warr[13] = SUrqst; warr[14] = SUresp; SAstrg = warr.join("~"); // recreate string AC_ServicesStoreArr[FStorIdx] = SAstrg; // update Store ServEditMode = "Repl"; // set mode rstat = RpmCC_AC.ServicesReplace(SAstrg); // update Database ServiceThreadToggleRequired = true; } } else { // otherwise, initiate Add and let ServiceAddOpComplete update the Store SAstrg = ServEditCID + "~~" + SUtype + "~" + SUto + "~" + SUret + "~" + SUport; SAstrg += "~" + SUname + "~" + SUrqst + "~" + SUresp + "~1"; ServAddStrg = ServEditCID + "~~" + SUtype + "~" + SUto + "~" + SUret + "~" + SUport; ServAddStrg += "~~~~~~" + SUname + "~" + SUrqst + "~" + SUresp + "~1"; ServEditMode = "Add"; // set mode rstat = RpmCC_AC.ServicesAdd(SAstrg); // Add to Database } } else { // Service not selected, see if in Store if ( (SAstrg = AC_ServicesStoreArr[FStorIdx]) != "" ) { warr = SAstrg.split("~"); // parse the parameter string ServEditMode = "Del"; // set mode AC_ServicesStoreArr[FStorIdx] = ""; // set null entry in Store rstat = RpmCC_AC.ServicesDelete(warr[0]); // Delete from Database } } if ( ServEditMode != null ) { // if Database Op initiated if ( rstat ) { // if unable to initiate request processEditComplete(); // finish up Edit top.Rstatus.Pstat("Unable to start the Services UPDATE request",true); } else { // waiting for OperationCompleteEvent top.Rstatus.Pstat("One moment while Services UPDATE request completes"); } } else { // no DB op pending, go do next Service processServicesOpComplete(); } } /* Process Duplicate Error in Computer Add / Replace Operation */ function processComputerUpdateErrorDuplicate() { alert("A Server/Device with the name '"+AC_Name.value+"' already exists in the DataBase! Use the Edit function if you want to modify its settings"); if ( AddServicesFlag != 0 ) { processAddComputers(); // go set up to Add next computer } else { processResetButton(); // reset } } /* Process Bad Group Error in Computer Add / Replace Operation */ function processComputerUpdateErrorBadGroup() { top.Rstatus.Pstat("Invalid Group ID. Cannot complete the UPDATE request",true); processResetButton(); // reset } /* Process Not Found Error in Computer Replace Operation */ function processComputerErrorNotFound() { top.Rstatus.Pstat("Server Name not found. Cannot complete the UPDATE/DELETE request",true); processResetButton(); // reset } /* Process DB Error in Computer Lookup Operation */ function processComputerOpError() { top.Rstatus.Pstat("An error occurred during requested operation",true); processResetButton(); // reset } /* Process Error in Computer Add Operation Due to Exceeding Max License Allowed*/ function processComputerLicenseError() { alert("'"+AC_Name.value+"' not added/changed. Currently at maximum licenses allowed. You have to upgrade your MonitorIT license if you want to monitor additional servers/devices"); processResetButton(); // reset top.Rstatus.Pstat("Done! "+TotalComputersAdded+" server(s) added"); } /* Process LOOKUP RECORD Event */ var Gix3 = 0; function processComputerLookupRecord(Cid,Gid,SrvID,Name,Desc,Pswd,OSVer,Addr,Port,AgentVer,DomainName,SNMPInfo) { Desc = (Desc.length == 0) ? "" : Desc; Pswd = (Pswd.length == 0) ? "" : Pswd; OSVer = (OSVer.length == 0) ? "" : OSVer; Addr = (Addr.length == 0) ? "" : Addr; Port = (Port.length == 0) ? "" : Port; SrvID = (SrvID.length == 0) ? "" : SrvID; if ( Gid != CGrpID ) { getGroupName(Gid,AC_GroupSel,AC_GrpStore); // determine GrpSelectIdx; Gix3 = (GroupRecLength*GrpSelectIdx)+3; CGrpID = Gid; } /* if match on a selected Group, add record to store */ if ( (allGrpSelected == 1) || (AC_GrpStore.options[Gix3].text == 1) ) { addElementToSelect(AC_NameSel,Name); var i = ComputerRecLength * LupRecCount; AC_StoreArr[i+0] = Name; AC_StoreArr[i+1] = Gid; AC_StoreArr[i+2] = Desc; AC_StoreArr[i+3] = Pswd; AC_StoreArr[i+4] = OSVer; AC_StoreArr[i+5] = Addr; AC_StoreArr[i+6] = Port; AC_StoreArr[i+7] = Cid; AC_StoreArr[i+8] = SrvID; AC_StoreArr[i+9] = AgentVer; AC_StoreArr[i+10] = DomainName; // Domain Name AC_StoreArr[i+11] = SNMPInfo; // Domain Name ++LupRecCount; // bump record received counter } } // Process Serverices LOOKUP Record Event function processServicesRecord(SRVstrg) { var warr = new Array(); warr = SRVstrg.split("~"); if ( ServiceCompID == null ) { // if first record ServiceCompID = warr[1]; // init with first Computer ID } var i = ServicesRecCount * ServicesRecLength; if ( warr[1] != ServiceCompID ) { // if new Computer ID var wcnt = ServicesRecCount % ServiceTypeCount; while ( wcnt < ServiceTypeCount ) { // round out previous AC_ServicesStoreArr[i++] = ServiceCompID; // Computer ID AC_ServicesStoreArr[i++] = ""; ++ServicesRecCount; // bump record counter ++wcnt; } ServiceCompID = warr[1]; // set new current Computer ID } ++ServicesRecCount; // bump record counter AC_ServicesStoreArr[i++] = warr[1]; // Computer ID AC_ServicesStoreArr[i] = SRVstrg; } // Process the Add Button Click from the Discovery Services Pop-up function processAddServices() { // Disable buttons SetButtonState(bSelC,"1"); SetButtonState(bUselC,"1"); SetButtonState(bAdd,"1"); SetButtonState(DiscoveryResetButton,"1"); CMode = "Lookup_DiscoveryAdd"; // set mode of operation allGrpSelected = true; LupRecCount = 0; // initialize record counter ServiceCompID = null; // init the Service Record Computer ID CurSelectIdx = 0; // reset current select index AC_StoreArr.length = 0; for ( var i=AC_NameSel.length; i>0; i-- ) { AC_NameSel.remove(0); } if ( RpmCC_AC.ComputerLookup("*","*") ) { processAddServicesContinue(); } } function processAddServicesContinue() { var PrevIPaddr = null; // initialize var SStrg = ""; var CkObj = null; CMode = "New"; // restore mode of operation AddServicesArr.length = 0; // reset // Determine Computers and Services to be Added for (var i=0, j=0; i< ELIdx; ++i ) { // Find each one CkObj = LogEventCheckBoxObjectArray[i]; // get line object if ( CkObj.checked && LogEventObjectArray[i].style.display == "" ) { // if checked and visible for (var k=0; k < AC_StoreArr.length; k+=ComputerRecLength) { if ( CkObj.ipaddr == AC_StoreArr[k+5] ) { break; // if already in Computer table } } if ( k < AC_StoreArr.length ) { CkObj.checked = ""; continue; // skip it } if ( CkObj.ipaddr != PrevIPaddr ) { // if new one if ( PrevIPaddr != null ) { // if not first time AddServicesArr[j++] = SStrg; // save } PrevIPaddr = CkObj.ipaddr; // set new previous SStrg = CkObj.ipaddr; SStrg += "," + CkObj.iname; // add name SStrg += "," + CkObj.domain; if ( CkObj.itype != "PING" ) { SStrg += ",PING"; // insure at least PING by default } } SStrg += "," + CkObj.itype; // add service type } } if ( SStrg == "" ) { alert("All the Servers/Devices you selected to Add are already in the MonitorIT database!\n -If you want to enable additional IP Services, do a 'Lookup' and 'Edit' of these Servers/Devices"); SetButtonState(bSelC,"0"); SetButtonState(bUselC,"0"); SetButtonState(DiscoveryResetButton,"0"); return; } AddServicesArr[j++] = SStrg; // save ComputerCount.innerText = j; LicCount.style.display = "none"; if ( j > (LicenseMax-LicenseCur) ) { ComputerCountMax.innerText = LicenseMax; ComputerCountRem.innerText = (LicenseMax-LicenseCur); ComputerCountRem1.innerText = (LicenseMax-LicenseCur); LicCount.style.display = ""; } PopUpConfirm.style.display=""; // enable Add Confirm pop-up } function processAddConfirmCancelButton() { SetButtonState(bSelC,"0"); SetButtonState(bUselC,"0"); SetButtonState(bAdd,"0"); SetButtonState(DiscoveryResetButton,"0"); PopUpConfirm.style.display="none"; // disable Add Confirm pop-up } function processAddConfirmOKButton() { PopUpConfirm.style.display="none"; // disable Add Confirm pop-up if ( EditBeforeAdd.checked ) { AddServicesFlag = 1; // Edit first } else { AddServicesFlag = 2; // Add unconditionally } ELogWinMain.style.display="none"; // dismiss log window AC_ServerSel.style.display=""; AC_DomainNSel.style.display=""; AC_GroupSel.style.display=""; AC_MIBSel.style.visibility="visible"; AddServicesArrIdx = 0; // set Array Index TotalComputersAdded = 0; // initialize processAddComputers(); // initaite the add ServiceSelect.style.display=""; } // Carry Out the Computer/Services Add Based on Edit Forst or Unconditional Add function processAddComputers() { var warr = new Array(); var warr1 = new Array(); if ( AddServicesArrIdx < AddServicesArr.length ) { // reset checkboxes resetServiceFields(); // set default name to be IP Address warr = AddServicesArr[AddServicesArrIdx++].split(","); // get params top.Rstatus.Pstat("Editing new record "+AddServicesArrIdx+" of "+AddServicesArr.length+"; Press 'Save' button when done editing",true); AC_Name.value = warr[1]; AC_IPAddr.value = warr[0]; AC_Desc.value = "("+warr[1]+") added via Discovery"; AC_DomainNSel.selectedIndex = 0; for ( var i=0; i<AC_DomainNSel.length; i++ ) { if ( AC_DomainNSel.options[i].value == warr[2] ) { AC_DomainNSel.selectedIndex = i; break; } } if ( warr[0] != warr[1] ) { // if name is not IP addr warr1 = warr[1].split("."); AC_Name.value = warr1[0]; } // process the selected services for ( var i=3; i<warr.length; i++ ) { switch ( warr[i] ) { case "PING" : tpingchk = "checked"; tpingto = DefaultPingTimeOut; tpingret = "2"; break; case "HTTP" : thttpchk = "checked"; thttpport = httpport.value; thttpto = DefaultServiceTimeOut; thttplookfor = ""; thttponpage = ""; thttpsec = (httpschk.checked) ? "1" : ""; break; case "FTP" : tftpchk = "checked"; tftpport = ftpport.value; tftpto = DefaultServiceTimeOut; tftpsec = (ftpschk.checked) ? "1" : ""; break; case "SMTP" : tsmtpchk = "checked"; tsmtpport = smtpport.value; tsmtpto = DefaultServiceTimeOut; tsmtpsec = (smtpschk.checked) ? "1" : ""; break; case "POP" : tpopchk = "checked"; tpopport = popport.value; tpopto = DefaultServiceTimeOut; tpopsec = (popschk.checked) ? "1" : ""; break; case "DNS" : tdnschk = "checked"; tdnsport = dnsport.value; tdnsto = DefaultServiceTimeOut; tdnsret = "2"; tdnsname = dnsname.value break; case "USER" : tuserchk = "checked"; tuserport = userport.value; tuserto = DefaultServiceTimeOut; tuserret = "2"; tuserrqst = userrqst.value tuserresp = userresp.value break; case "SQL" : tsqlchk = "checked"; tsqlto = DefaultServiceTimeOut; tsqlparms = warr[1]+",sa,,"; AC_Name.value = "SQL Server Check of "+warr[1]; break; case "SNMP" : tsnmpchk = "checked"; tsnmpto = DefaultServiceTimeOut; tsnmpret = "2"; tsnmpparms = snmprqst.value+",public,1" break; case "TELNET" : ttelchk = "checked"; ttelport = telport.value; ttelto = DefaultServiceTimeOut; ttelsec = (telschk.checked) ? "1" : ""; break; case "ORACLE" : toraclechk = "checked"; toracleto = DefaultServiceTimeOut; toracleparms = warr[1]+",sa,,"; //AC_Name.value = "SQL Server Check of "+warr[1]; break; case "L_NOTES" : tlnoteschk = "checked"; tlnotesport = lnotesport.value; tlnotesto = DefaultServiceTimeOut; tlnotesret = "2"; tlnotesrqst = lnotesrqst.value tlnotesresp = lnotesresp.value break; } } j=0; // default to PING selected for display if ( tpingchk ) { j = 0; } // find the first service selected else if ( thttpchk ) { j = 1; } else if ( tftpchk ) { j = 2; } else if ( tsmtpchk ) { j = 3; } else if ( tpopchk ) { j = 4; } else if ( tdnschk ) { j = 5; } else if ( tuserchk ) { j = 6; } else if ( tsqlchk ) { j = 7; } else if ( tsnmpchk ) { j = 8; } else if ( ttelchk ) { j = 9; } else if ( toraclechk ) { j = 10; } else if ( tlnoteschk ) { j = 11; } // Hide input fields rqstin.style.visibility="hidden"; respin.style.visibility="hidden"; sqlsrv.style.visibility="hidden"; sqlusr.style.visibility="hidden"; ServiceSelect.selectedIndex = j; // set the selected one processServiceSelectPut(); // set up display // if Add without Edit; go do update; otherwiese let user press Update if ( AddServicesFlag == 2 ) { processUpdateButton(); } else { // insure buttons are enabled SetButtonState(CUpdateButton,"0"); SetButtonState(CResetButton,"0"); SetButtonState(InstallAgentButton,"0"); SetButtonState(ManageAgentsButton,"0"); SetButtonState(WMButton,"0"); } } else { // done; go reset processResetButton(); top.Rstatus.Pstat("Done! "+TotalComputersAdded+" computer(s) added"); ckQuickStartdone(); // check if QuickStart, and put upmessage box if so } } // Process the Change of the Current Service Selected from the Drop-Down var prevServiceSelectIndex = 0; function processServiceSelectChange() { if ( processServiceSelectGet() == false ) // if invalid input return; processServiceSelectPut(); } // Save Fields from Previous Services Selection function processServiceSelectGet() { switch ( prevServiceSelectIndex ) { case 0 : tpingchk = (genchk.checked) ? "checked" : ""; if ( chkServiceInput(tpingchk,1,1,0,0,0,0) == false ) return false; tpingto = gento.value; tpingret = genret.value; genport.value = ""; genname.value = ""; genrqst.value = ""; genresp.value = ""; break; case 1 : thttpchk = (genchk.checked) ? "checked" : ""; if ( chkServiceInput(thttpchk,1,0,1,0,0,0) == false ) return false; thttpto = gento.value; thttpport = genport.value; thttpsec = (securechk.checked) ? "1" : ""; thttplookfor = genname.value; thttponpage = (genresp.value != "") ? "/"+genresp.value : ""; genret.value = ""; genrqst.value = ""; rqstin.style.visibility="hidden"; respin.style.visibility="hidden"; break; case 2 : tftpchk = (genchk.checked) ? "checked" : ""; if ( chkServiceInput(tftpchk,1,0,1,0,0,0) == false ) return false; tftpto = gento.value; tftpport = genport.value; tftpsec = (securechk.checked) ? "1" : ""; genret.value = ""; genname.value = ""; genrqst.value = ""; genresp.value = ""; break; case 3 : tsmtpchk = (genchk.checked) ? "checked" : ""; if ( chkServiceInput(tsmtpchk,1,0,1,0,0,0) == false ) return false; tsmtpto = gento.value; tsmtpport = genport.value; tsmtpsec = (securechk.checked) ? "1" : ""; genret.value = ""; genname.value = ""; genrqst.value = ""; genresp.value = ""; break; case 4 : tpopchk = (genchk.checked) ? "checked" : ""; if ( chkServiceInput(tpopchk,1,0,1,0,0,0) == false ) return false; tpopto = gento.value; tpopport = genport.value; tpopsec = (securechk.checked) ? "1" : ""; genret.value = ""; genname.value = ""; genrqst.value = ""; genresp.value = ""; break; case 5 : tdnschk = (genchk.checked) ? "checked" : ""; if ( chkServiceInput(tdnschk,1,1,1,1,0,0) == false ) return false; tdnsto = gento.value; tdnsret = genret.value; tdnsport = genport.value; tdnsname = genname.value; genrqst.value = ""; genresp.value = ""; rqstin.style.visibility="hidden"; break; case 6 : tuserchk = (genchk.checked) ? "checked" : ""; if ( chkServiceInput(tuserchk,1,1,1,0,0,0) == false ) return false; tuserto = gento.value; tuserret = genret.value; tuserport = genport.value; genname.value = ""; tuserrqst = genrqst.value; tuserresp = genresp.value; rqstin.style.visibility="hidden"; respin.style.visibility="hidden"; break; case 7 : tsqlchk = (genchk.checked) ? "checked" : ""; if ( chkServiceInput(tsqlchk,1,0,0,0,0,0) == false ) return false; tsqlto = gento.value; genret.value = ""; genport.value = ""; genname.value = ""; tsqlparms = sqlsrvnme.value+","+sqlusrnme.value+","+genresp.value+","+genrqst.value; genresptext.innerHTML = '<input id="genresp" type="text" maxLength="150" size="25" class="idis" onClick="chkDisabled(this)" onkeypress="chkDisabled(this)" >'; genresp.value = ""; rqstin.style.visibility="hidden"; respin.style.visibility="hidden"; sqlsrv.style.visibility="hidden"; sqlusr.style.visibility="hidden"; break; case 8 : tsnmpchk = (genchk.checked) ? "checked" : ""; if ( chkServiceInput(tsnmpchk,1,1,0,0,1,1) == false ) return false; tsnmpto = gento.value; tsnmpret = genret.value; genport.value = ""; genname.value = ""; var warr = new Array(); warr = sqlusrnme.value.split(";"); var oid = warr.join("^"); tsnmpparms = genrqst.value+","+genresp.value+",1,"+sqlsrvnme.value+","+oid; rqstin.style.visibility="hidden"; respin.style.visibility="hidden"; sqlsrv.style.visibility="hidden"; sqlusr.style.visibility="hidden"; break; case 9 : ttelchk = (genchk.checked) ? "checked" : ""; if ( chkServiceInput(ttelchk,1,0,1,0,0,0) == false ) return false; ttelto = gento.value; ttelport = genport.value; ttelsec = (securechk.checked) ? "1" : ""; genret.value = ""; genname.value = ""; genrqst.value = ""; genresp.value = ""; break; case 10 : toraclechk = (genchk.checked) ? "checked" : ""; if ( chkServiceInput(toraclechk,1,0,0,0,0,0) == false ) return false; toracleto = gento.value; genret.value = ""; genport.value = ""; genname.value = ""; toracleparms = sqlsrvnme.value+","+sqlusrnme.value+","+genresp.value+","+genrqst.value; genresptext.innerHTML = '<input id="genresp" type="text" maxLength="150" size="25" class="idis" onClick="chkDisabled(this)" onkeypress="chkDisabled(this)" >'; genresp.value = ""; rqstin.style.visibility="hidden"; respin.style.visibility="hidden"; sqlsrv.style.visibility="hidden"; sqlusr.style.visibility="hidden"; break; case 11 : tlnoteschk = (genchk.checked) ? "checked" : ""; if ( chkServiceInput(tlnoteschk,1,1,1,0,0,0) == false ) return false; tlnotesto = gento.value; tlnotesret = genret.value; tlnotesport = genport.value; genname.value = ""; tlnotesrqst = genrqst.value; tlnotesresp = genresp.value; rqstin.style.visibility="hidden"; respin.style.visibility="hidden"; break; } return true; } // Validate Service Parameters Input function chkServiceInput(chkflg,toflg,retflg,portflg,nameflg,rqstflg,respflg) { if ( chkflg == "") // not checked, don't care return true; OKflg = true; if ( toflg == 1 ) { if ( gento.value == "" || gento.value == "0" ) { OKflg = false; gento.focus(); } } if ( retflg == 1 ) { if ( genret.value == "" || genret.value == "0" ) { OKflg = false; genret.focus(); } } if ( portflg == 1 ) { if ( genport.value == "" ) { OKflg = false; genport.focus(); } } if ( nameflg == 1 ) { if ( genname.value == "" ) { OKflg = false; genname.focus(); } } if ( rqstflg == 1 ) { if ( genrqst.value == "" ) { OKflg = false; genrqst.focus(); } } if ( respflg == 1 ) { if ( genresp.value == "" ) { OKflg = false; genresp.focus(); } } if ( OKflg == false ) { // if NG parameter ServiceSelect.selectedIndex = prevServiceSelectIndex; // reset selected index top.Rstatus.Pstat("Required input parameter missing or invalid 0 value",true); alert("Required input parameter missing or invalid 0 value"); } return OKflg; } // Set Fields for New Current Services Selection function processServiceSelectPut() { var warr = new Array(); securechk.checked = ""; switch ( ServiceSelect.selectedIndex ) { case 0 : genchk.checked = tpingchk; gento.value = (tpingto=="") ? DefaultPingTimeOut : tpingto; genret.value = (tpingret=="") ? "2" : tpingret; genport.value = ""; genname.value = ""; genrqst.value = ""; genresp.value = ""; endisFields(0,1,1,0,0,0,0); // enable disable appropriate fields break; case 1 : genchk.checked = thttpchk; gento.value = (thttpto=="") ? DefaultServiceTimeOut : thttpto; genret.value = ""; genport.value = (thttpport=="") ? "80" : thttpport; genname.value = thttplookfor; genrqst.value = ""; securechk.checked = (thttpsec == "1") ? "checked" : ""; //parse out the leading "/" genresp.value = thttponpage.substring(1,thttponpage.length); rqstin.style.visibility="visible"; genname.style.display=""; genrqst.style.display="none"; rqsttext.innerText = "Look For: "; rqsttext.title = "Optional, look for this string and verify on checked web page" respin.style.visibility="visible"; resptext.innerHTML = "Page Name: "; resptext.title = "Optional, specify an alternate web page to check instead of the default web page" endisFields(1,1,0,1,1,0,1); // enable disable appropriate fields break; case 2 : genchk.checked = tftpchk; gento.value = (tftpto=="") ? DefaultServiceTimeOut : tftpto; genret.value = ""; genport.value = (tftpport=="") ? "21" : tftpport; genname.value = ""; genrqst.value = ""; genresp.value = ""; securechk.checked = (tftpsec == "1") ? "checked" : ""; endisFields(1,1,0,1,0,0,0); // enable disable appropriate fields break; case 3 : genchk.checked = tsmtpchk; gento.value = (tsmtpto=="") ? DefaultServiceTimeOut : tsmtpto; genret.value = ""; genport.value = (tsmtpport=="") ? "25" : tsmtpport; genname.value = ""; genrqst.value = ""; genresp.value = ""; securechk.checked = (tsmtpsec == "1") ? "checked" : ""; endisFields(1,1,0,1,0,0,0); // enable disable appropriate fields break; case 4 : genchk.checked = tpopchk; gento.value = (tpopto=="") ? DefaultServiceTimeOut : tpopto; genret.value = ""; genport.value = (tpopport=="") ? "110" : tpopport; genname.value = ""; genrqst.value = ""; genresp.value = ""; securechk.checked = (tpopsec == "1") ? "checked" : ""; endisFields(1,1,0,1,0,0,0); // enable disable appropriate fields break; case 5 : genchk.checked = tdnschk; gento.value = (tdnsto=="") ? DefaultServiceTimeOut : tdnsto; genret.value = (tdnsret=="") ? "2" : tdnsret; genport.value = (tdnsport=="") ? "53" : tdnsport; genname.value = tdnsname; genrqst.value = ""; genresp.value = ""; rqstin.style.visibility="visible"; genname.style.display=""; genrqst.style.display="none"; rqsttext.innerText = "Resolve Name: "; rqsttext.title = "Some domain name is required to use in checking the DNS server"; endisFields(0,1,1,1,1,0,0); // enable disable appropriate fields break; case 6 : genchk.checked = tuserchk; gento.value = (tuserto=="") ? DefaultServiceTimeOut : tuserto; genret.value = (tuserret=="") ? "2" : tuserret; genport.value = (tuserport=="") ? "100" : tuserport; genname.value = ""; genrqst.value = tuserrqst; genresp.value = tuserresp; rqstin.style.visibility="visible"; respin.style.visibility="visible"; genname.style.display="none"; genrqst.style.display=""; rqsttext.innerHTML = "Request: "; rqsttext.title = "Required string that is sent to the specified server" resptext.innerHTML = "Response: "; resptext.title = "" endisFields(0,1,1,1,0,1,1); // enable disable appropriate fields break; case 7 : genchk.checked = tsqlchk; gento.value = (tsqlto=="") ? DefaultServiceTimeOut : tsqlto; genret.value = ""; genport.value = ""; genname.value = ""; genresptext.innerHTML = '<input id="genresp" type="password" maxLength="150" size="25" class="idis" onClick="chkDisabled(this)" onkeypress="chkDisabled(this)" >'; warr = tsqlparms.split(","); genrqst.value = warr[3]; genresp.value = warr[2]; rqstin.style.visibility="visible"; respin.style.visibility="visible"; genname.style.display="none"; genrqst.style.display=""; rqsttext.innerHTML = "Database: "; rqsttext.title = "" resptext.innerHTML = "Password: "; resptext.title = "" sqlstext.innerHTML = "Server Name: " sqlutext.innerHTML = "User Name: " sqlsrvnme.value = (warr[0] == "") ? AC_Name.value : warr[0]; sqlusrnme.value = warr[1]; sqlsrv.style.visibility="visible"; sqlusr.style.visibility="visible"; if ( CMode == "Edit" || CMode == "New" ) { sqlsrvnme.disabled = sqlsrvnme.className = ""; sqlusrnme.disabled = sqlusrnme.className = ""; } endisFields(0,1,0,0,0,1,1); // enable disable appropriate fields break; case 8 : genchk.checked = tsnmpchk; gento.value = (tsnmpto=="") ? DefaultServiceTimeOut : tsnmpto; genret.value = (tsnmpret=="") ? "2" : tsnmpret; genport.value = ""; genname.value = ""; warr = tsnmpparms.split(","); genrqst.value = warr[0]; genresp.value = warr[1]; var oid = (warr.length >= 5) ? warr[4] : ""; var warrs = new Array(); warrs = oid.split("^"); oid = warrs.join(";"); sqlsrvnme.value = (warr.length >= 4) ? warr[3] : ""; sqlusrnme.value = oid; rqstin.style.visibility="visible"; respin.style.visibility="hidden"; sqlsrv.style.visibility="visible"; sqlusr.style.visibility="visible"; sqlstext.innerHTML = "Look For: " sqlutext.innerHTML = "OID(s): " genname.style.display="none"; genrqst.style.display=""; rqsttext.innerHTML = "Read Community: "; rqsttext.title = "" resptext.innerHTML = ""; //"Write Community: "; resptext.title = "" if ( CMode == "Edit" || CMode == "New" ) { sqlsrvnme.disabled = sqlsrvnme.className = ""; sqlusrnme.disabled = sqlusrnme.className = ""; } endisFields(0,1,1,0,0,1,1); // enable disable appropriate fields break; case 9 : genchk.checked = ttelchk; gento.value = (ttelto=="") ? DefaultServiceTimeOut : ttelto; genret.value = ""; genport.value = (ttelport=="") ? "23" : ttelport; genname.value = ""; genrqst.value = ""; genresp.value = ""; securechk.checked = (ttelsec == "1") ? "checked" : ""; endisFields(1,1,0,1,0,0,0); // enable disable appropriate fields break; case 10 : genchk.checked = toraclechk; gento.value = (toracleto=="") ? DefaultServiceTimeOut : toracleto; genret.value = ""; genport.value = ""; genname.value = ""; genresptext.innerHTML = '<input id="genresp" type="password" maxLength="150" size="25" class="idis" onClick="chkDisabled(this)" onkeypress="chkDisabled(this)" >'; warr = toracleparms.split(","); genrqst.value = warr[3]; genresp.value = warr[2]; rqstin.style.visibility="visible"; respin.style.visibility="visible"; genname.style.display="none"; genrqst.style.display=""; rqsttext.innerHTML = "Database: "; rqsttext.title = "" resptext.innerHTML = "Password: "; resptext.title = "" sqlstext.innerHTML = "Server Name: " sqlutext.innerHTML = "User Name: " sqlsrvnme.value = (warr[0] == "") ? AC_Name.value : warr[0]; sqlusrnme.value = warr[1]; sqlsrv.style.visibility="visible"; sqlusr.style.visibility="visible"; if ( CMode == "Edit" || CMode == "New" ) { sqlsrvnme.disabled = sqlsrvnme.className = ""; sqlusrnme.disabled = sqlusrnme.className = ""; } endisFields(0,1,0,0,0,1,1); // enable disable appropriate fields break; case 11 : genchk.checked = tlnoteschk; gento.value = (tlnotesto=="") ? DefaultServiceTimeOut : tlnotesto; genret.value = (tlnotesret=="") ? "2" : tlnotesret; genport.value = (tlnotesport=="") ? "1352" : tlnotesport; genname.value = ""; genrqst.value = tlnotesrqst; genresp.value = tlnotesresp; rqstin.style.visibility="visible"; respin.style.visibility="visible"; genname.style.display="none"; genrqst.style.display=""; rqsttext.innerHTML = "Request: "; rqsttext.title = "Required string that is sent to the specified server" resptext.innerHTML = "Response: "; resptext.title = "" endisFields(0,1,1,1,0,1,1); // enable disable appropriate fields break; } prevServiceSelectIndex = ServiceSelect.selectedIndex; } // Enable/disable appropriate Services Fields function endisFields(scF,tF,rF,pF,nF,qF,sF) { if ( CMode != "Edit" && CMode != "New" ) { return; // ignore if not editing mode } if ( scF == 1 ) { securechk.disabled = gento.className = ""; } else { securechk.disabled = "disabled"; securechk.className = "idis"; securechk.checked == "" } if ( tF == 1 ) { gento.disabled = gento.className = ""; } else { gento.className = "idis"; } if ( rF == 1 ) { genret.disabled = genret.className = ""; } else { genret.className = "idis"; } if ( pF == 1 ) { genport.disabled = genport.className = ""; } else { genport.className = "idis"; } if ( nF == 1 ) { genname.disabled = genname.className = ""; } else { genname.className = "idis"; } if ( qF == 1 ) { genrqst.disabled = genrqst.className = ""; } else { genrqst.className = "idis"; } if ( sF == 1 ) { genresp.disabled = genresp.className = ""; } else { genresp.className = "idis"; } } // Reset all Services Fields function resetServiceFields() { tpingchk=""; tpingto="5"; tpingret=""; thttpchk=""; thttpport=""; thttpto="5"; thttplookfor=""; thttponpage=""; tftpchk=""; tftpport=""; tftpto="5"; ttelchk=""; ttelport=""; ttelto="5"; tsmtpchk=""; tsmtpport=""; tsmtpto="5"; tpopchk=""; tpopport=""; tpopto="5"; tdnschk=""; tdnsport=""; tdnsto="5"; tdnsret=""; tdnsname=""; tuserchk=""; tuserport=""; tuserto="5"; tuserret=""; tusername=""; tuserrqst=""; tuserresp=""; tuserpart=""; tsqlchk=""; tsqlto=""; tsqlparms=",sa,,"; toraclechk=""; toracleto=""; toracleparms=",sa,,"; tlnoteschk=""; tlnotesport=""; tlnotesto="5"; tlnotesret=""; tlnotesname=""; tlnotesrqst=""; tlnotesresp=""; tlnotespart=""; tsnmpchk=""; tsnmpto="5"; tsnmpret=""; tsnmpparms="public,public,1"; genchk.checked=""; gento.value="5"; genret.value=""; securechk.checked=""; genport.value = ""; genname.value = ""; genrqst.value = ""; genresp.value = ""; } // Reset DB Change Event flag function resetDBCEF() { CTid = null; ignoreDBChangeEvent = 0; } function PopUpContextOpen() { AC_NameSel.style.visibility = "hidden"; AC_GroupSel.style.visibility = "hidden"; AC_ServerSel.style.visibility = "hidden"; AC_DomainNSel.style.visibility = "hidden"; ServiceSelect.style.visibility = "hidden"; AC_MIBSel.style.visibility="hidden"; } function PopUpContextClose() { AC_NameSel.style.visibility = "visible"; AC_GroupSel.style.visibility = "visible"; AC_ServerSel.style.visibility = "visible"; AC_DomainNSel.style.visibility = "visible"; ServiceSelect.style.visibility = "visible"; AC_MIBSel.style.visibility="visible"; } // Process Click on the Discovery Show All Checkbox var VisibleCount; function processShowAll() { var CkObj = null; var DispAll = ShowAllEnabled.checked; ELBgFlg = 0; // init the flag // Find Log Lines with Good status and not currently in the Database for (var i=0,j=0; i< ELIdx; ++i ) { // Find each one CkObj = LogEventObjectArray[i]; // get line object if ( DispAll || CkObj.istat == "0" ) { if ((ELBgFlg ^= 1) == 0) { CkObj.style.backgroundColor = "white"; } else { CkObj.style.backgroundColor = "e8e8e8"; } CkObj.style.display = ""; ++j; } else { CkObj.style.display = "none"; } } VisibleCount = j; } function processKeyPress() { /* get KeyCode and check if invalid */ kc = event.keyCode; stat = 1; // default to OK // Keys: ~ % [ ] # ! if (kc == 126 || kc == 37 || kc == 91 || kc == 93 || kc == 35 || kc == 33) { // Not acceptable stat = 0; } // Keys: * ? else if ( (kc == 42 || kc == 63) && (event.srcElement.name != "AC_Name" && event.srcElement.name != "AC_Group") ) { //Not acceptable stat = 0; } else if ( (CMode != "" && CMode != "Lookup") && (kc == 42 || kc == 63) ) { // Not accpetable stat = 0; } if (stat == 0) { // if Not Acceptable event.returnValue=false; top.Rstatus.Pstat("Keys ~%*?[]#! are not accepted for this field"); alert("Keys ~%*?[]#! are not accepted for this field"); } else if ( (event.srcElement.name == "AC_Port") && (kc < 48 || kc > 57) ) { event.returnValue=false; top.Rstatus.Pstat("Numeric keys only accepted"); alert("Numeric keys only accepted"); } /* else if ( (event.srcElement.name == "AC_IPAddr") && ((kc < 48 || kc > 57) && (kc != 46)) ) { event.returnValue=false; top.Rstatus.Pstat("Numeric keys or . only accepted"); } */ else { top.Rstatus.Pstat(""); // clear status line } } function processKeyPressPassword() { /* get KeyCode and check if invalid */ kc = event.keyCode; stat = 1; // default to OK // Keys: ~ if (kc == 126) { // Not acceptable stat = 0; } // Keys: * ? if (stat == 0) { // if Not Acceptable event.returnValue=false; top.Rstatus.Pstat("Tilde Key '~' is not accepted for this field"); alert("Tilde Key '~' is not accepted for this field"); } else { top.Rstatus.Pstat(""); // clear status line } } /* Process the Verify Password fields */ function processVerifyPassword() { if ( AC_Pswd.value != AC_VPswd.value) { AC_VPswd.value = ""; top.Rstatus.Pstat("Verify Password Does Not Match Password, please reenter it",true); alert("Verify Password Does Not Match Password, please reenter it"); AC_VPswd.focus(); } else { top.Rstatus.Pstat(""); // clear status line } } /* Process Group OP Complete Event */ function processGroupOpComplete() { if ( IMode == "Lookup" ) { if (GrpLupRecCount == 0) { // check if any records found if ( IModeFirstTimeGroup ) { // No records found, try adding default group one time IModeFirstTimeGroup = false; // reset IMode = "Add"; // Add Group rstat = RpmCC_AC.GroupAdd("Auto Register Group","System generated group for auto registered computers"); if ( !rstat ) { ++ignoreDBChangeEvent; // ignore DB change event return; // exit and await add complete } } IMode = ""; top.Rstatus.Pstat("No GROUPS found. Go to Configure Groups and define at least one NEW Group",true); AC_GroupSel.className = "idis"; AC_Name.className = "idis"; if ( AC_GroupSel.style.visibility != "hidden" ) { AC_GroupSel.focus(); } } else { //SetButtonState(CNewButton,"0"); top.Rstatus.Pstat("Done"); if ( top.QuickStartProcessing ) { showHelp('Help/QuickStart_Help.htm#Discovery'); processNewButton(); if ( CMode != "New" ) { // Must be at max license ckQuickStartdone(); } else { processDiscoverButton(); window.focus(); } } else{ processLookupButton(); } } } else if ( IMode == "Add" ) { IMode = "Lookup"; if ( RpmCC_AC.GroupLookup("","","") ) { // Group added, try Group lookup top.Rstatus.Pstat("Unable to start the GROUP LOOKUP request",true); IMode = ""; } } } /* Set initial button state for all buttons */ function initButtonState() { SetButtonState(CNewButton,"1"); SetButtonState(CUpdateButton,"1"); SetButtonState(CResetButton,"1"); SetButtonState(CEditButton,"1"); SetButtonState(CDupButton,"1"); SetButtonState(CDeleteButton,"1"); SetButtonState(DiscoveryButton,"1"); SetButtonState(VerifyButton,"1"); SetButtonState(InstallAgentButton,"1"); SetButtonState(ManageAgentsButton,"1"); SetButtonState(WMButton,"1"); } function SetButtonState(BtObj,BState) { //BtObj.className = (BState == "0") ? "BoxButton" : "BoxButtonD"; BtObj.disabled = (BState == "0") ? "" : "disabled"; BtObj.bdis = BState; } function saveButtonState() { sButtonState(CNewButton); sButtonState(CUpdateButton); sButtonState(CResetButton); sButtonState(CEditButton); sButtonState(CDupButton); sButtonState(CDeleteButton); sButtonState(DiscoveryButton); sButtonState(VerifyButton); sButtonState(InstallAgentButton); sButtonState(ManageAgentsButton); sButtonState(WMButton); } function restoreButtonState() { rButtonState(CNewButton); rButtonState(CUpdateButton); rButtonState(CResetButton); rButtonState(CEditButton); rButtonState(CDupButton); rButtonState(CDeleteButton); rButtonState(DiscoveryButton); rButtonState(VerifyButton); rButtonState(InstallAgentButton); rButtonState(ManageAgentsButton); rButtonState(WMButton); } function sButtonState(BtObj) { BtObj.sbs = BtObj.bdis; SetButtonState(BtObj,"1") } function rButtonState(BtObj) { SetButtonState(BtObj,BtObj.sbs) } /* Process Servers Lookup OP Complete Event */ function processServersOpComplete() { if ( IMode == "Lookup" ) { // Process Server Lookup if (SrvLupRecCnt == 0) { // check if any records found if ( IModeFirstTimeServer ) { // No records found, try adding default server one time IModeFirstTimeServer= false; // reset IMode = "Add"; // Add Server rstat = RpmCC_AC.ServersAdd("My Local Server","System Generated Default Server","127.0.0.1","82"); // try adding default server if ( !rstat ) { // if successful ++ignoreDBChangeEvent; // ignore DB change event return; // exit and await add complete } } IMode = ""; top.Rstatus.Pstat("No SERVERS found. Go to Administer Servers and define at least one NEW Server",true); AC_GroupSel.className = "idis"; AC_Name.className = "idis"; if ( AC_GroupSel.style.visibility != "hidden" ) { AC_GroupSel.focus(); } } else if ( RpmCC_AC.GroupLookup("","","") ) { // Server found, try Group lookup top.Rstatus.Pstat("Unable to start the GROUP LOOKUP request",true); IMode = ""; } } else if ( IMode == "Add" ) { // Try Servers Lookup Again IMode = "Lookup"; if ( RpmCC_AC.AdminServersLookup("*") ) { IMode = ""; top.Rstatus.Pstat("Unable to start the SERVER LOOKUP request",true); } } } /* Initialize the Discovery/Verify Status Log Windows */ function processLogWindow() { /* Format Output to Log Window */ ELogWin.innerHTML = ELogWinInit; VisibleCount = 0; LogEventCheckBoxObjectArray.length = LogEventObjectArray.length = 0; FOps = "<table id='ploghdr' border='0' cellpadding='1' cellSpacing='1' width='100%'><tr>"; if ( ELChkBoxCount != -1 ) { FOps += "<td width='4%' align='center' style='background-color:activeborder' class='optextb'>"; FOps += "Add" + "</td>"; } FOps += "<td width='6%' align='center' style='background-color:activeborder' class='optextb'>"; FOps += "Status" + "</td>"; FOps += "<td width='23%' align='center' style='background-color:activeborder' class='optextb'>"; FOps += "Name" + "</td>"; FOps += "<td width='16%' align='center' style='background-color:activeborder' class='optextb'>"; FOps += "IP Address" + "</td>"; FOps += "<td width='9%' align='center' style='background-color:activeborder' class='optextb'>"; FOps += "Type" + "</td>"; FOps += "<td width='*' align='center' style='background-color:activeborder' class='optextb'>"; FOps += "Reason" + "</td>"; FOps += "</tr></table>"; ELogWin.insertAdjacentHTML("afterBegin",FOps); } var LogEventObjectArray = new Array(); var LogEventCheckBoxObjectArray = new Array(); /* Output Discovery/Verify Events to Log Window */ function outputLogEvent(Lstat,Lipaddr,Ltype,Lreason,Ldname,CDNme) { var warr = new Array(); ocolor = (Lstat == 0) ? "g" : "r"; Lstatstrg = (Lstat == 0) ? "<img src='images/apply.gif' align='absmiddle' height='16' width='16'>" : "<img src='images/reset.gif' align='absmiddle' height='15' width='15'>"; FOps = "<div id='discrow" + ELIdx + "' istat='" + Lstat; if ( ShowAllEnabled.checked == false && Lstat != 0 ) { FOps += "' style='background-color:white;display:none'>"; } else { if ((ELBgFlg ^= 1) == 0) { FOps += "' style='background-color:white;"; } else { FOps += "' style='background-color:e8e8e8;"; } FOps += "'>"; ++VisibleCount; } FOps += "<table border='0' cellpadding='1' cellSpacing='1' width='100%'><tr>"; if ( ELChkBoxCount != -1 ) { FOps += "<td width='4%' align='center' class='optext'>"; FOps += "<input onclick='processCheckClick()' id='disc" + ELIdx + "' ipaddr='"; FOps += Lipaddr + "' iname='" + Ldname + "' domain='" + CDNme + "' itype='" + Ltype + "' type='checkbox'>" + "</td>"; } FOps += "<td width='6%' class='optext' align='center'>"; FOps += Lstatstrg + "</td>"; var cdname = ""; // preset tip if ( Ldname != Lipaddr ) { cdname = Ldname; warr = Ldname.split("."); Ldname = warr[0]; } FOps += "<td width='23%' style='fontFamily:arial' title='"+cdname+"' class='optext" + ocolor + "'>"; FOps += Ldname + "</td>"; FOps += "<td width='16%' style='fontFamily:arial' class='optext" + ocolor + "'>"; FOps += Lipaddr + "</td>"; FOps += "<td width='9%' class='optext" + "'>"; FOps += Ltype + "</td>"; FOps += "<td width='*' class='optext" + "'>"; FOps += Lreason + "</td>"; FOps += "</tr></table></div>"; ELogText.insertAdjacentHTML("afterBegin",FOps); LogEventObjectArray[ELIdx] = document.all["discrow"+ELIdx]; LogEventCheckBoxObjectArray[ELIdx] = document.all["disc"+ELIdx]; ++ELIdx; // bump index count } /* Process Response to Discover Request */ var crip = "", crname = ""; function processResponse(ReqID,RetCode,Reason,Rname) { for ( var i=0; i<RespAR.length; i+=RespArLth ) { if ( ReqID == RespAR[i] ) { // if match RespCount--; // decrement response count if ( RespAR[i+2] == "SNMP" && RetCode == "0" && Rname != "" ) { RespAR[i+3] = Rname; } if ( !WinDomain_DIP && DomainLUP.checked == true && RetCode == "0") { if ( crip == RespAR[i+1] && crname != "" ) { RespAR[i+3] = crname; } else { crname = RpmMIL.ResolveIPAddrToName(RespAR[i+1]); crip = RespAR[i+1]; if ( crname != "" ) { RespAR[i+3] = crname; } else { crname = crip; } } } outputLogEvent(RetCode,RespAR[++i],RespAR[++i],Reason,RespAR[++i],CurrentDiscoveryDomain); break; } } } // Enable Discovery Pop-up Window function processDiscoverButton() { processNewButton(); ServiceSelect.style.display="none"; AC_ServerSel.style.display="none"; AC_DomainNSel.style.display="none"; AC_GroupSel.style.display="none"; AC_MIBSel.style.visibility="hidden"; SetButtonState(CUpdateButton,"1"); SetButtonState(CResetButton,"1"); SetButtonState(InstallAgentButton,"1"); PopUpDiv.style.display=""; quad1.focus(); SetButtonState(DiscoveryButton,"1"); } // Process Discovery OK Button var RespAR = new Array(); var SQL_DIP = false; var ORACLE_DIP = false; var WinDomain_DIP = false; var WinDomainUsed = false; var WinDomainIdx = -1; function processOKButton() { DomainFilter.style.display="none"; // Validate input if ( !windomainchk.checked && !ipaddrchk.checked ) { alert("Please select a Discovery Method"); return; } if ( ipaddrchk.checked ) { if ( quad1.value == "" || quad1.value > 255 ) { alert("Please specify a value less than 255"); quad1.focus(); return; } if ( quad2.value == "" || quad2.value > 255 ) { alert("Please specify a value less than 255"); quad2.focus(); return; } if ( quad3.value == "" || quad3.value > 255 ) { alert("Please specify a value less than 255"); quad3.focus(); return; } if ( quad4from.value == "" || parseInt(quad4from.value,10) > parseInt(quad4to.value,10) ) { alert("Please specify a value less than the 'To' value"); quad4from.focus(); return; } if ( quad4to.value == "" || quad4to.value > 255 ) { alert("Please specify a value less than 255"); quad4from.focus(); return; } SrchIdx = parseInt(quad4from.value,10); // initialize indices SrchIdxMax = parseInt(quad4to.value,10); ipaddrbase = quad1.value+"."+quad2.value+"."+quad3.value+"."; } else { SrchIdx = 1; // No IP Addr range check SrchIdxMax = 0; } if ( pingchk.checked == false && httpportchk.checked == false && ftpportchk.checked == false && smtpportchk.checked == false && popportchk.checked == false && dnsportchk.checked == false && userportchk.checked == false && snmpchk.checked == false && telportchk.checked == false) { alert("Please select one or more services by clicking on the associated checkbox(s)!"); quad1.focus(); return; } /* Initiate the Discovery */ PopUpDiv.style.display="none"; SetButtonState(CUpdateButton,"0"); SetButtonState(CResetButton,"0"); SetButtonState(InstallAgentButton,"0"); RespArIx=0; RespAR.length = 0; RespCount = 0; // reset response count ELBgFlg = 0; // flag for alternating background color ELIdx = 0; // output log index ELChkBoxCount = 0; // reset Checkbox count SetButtonState(bAdd,"1"); SetButtonState(bSelC,"1"); SetButtonState(bUselC,"1"); SetButtonState(DiscoveryResetButton,"1"); ELogHeader.innerText = "Server Discovery Status"; ELogHeaderImg.src="images/discovery.gif" processLogWindow(); bSelC.style.display = ""; bUselC.style.display = ""; bAdd.style.display = ""; ELogWinMain.style.display=""; SetButtonState(StopButton,"1"); SetButtonState(DiscoveryResetButton,"1"); SetButtonState(VerifyButton,"1"); SetButtonState(DiscoveryPrintButton,"1"); DiscoverWait.style.visibility="visible"; // if Windows Domain discovery is checked,initiate it if ( windomainchk.checked ) { WinDomainIdx = -1; WinDomain_DIP = true; WinDomainUsed = true; RespCount=0; CurrentDomainIndex = 0; EnumeratedServersArr.length = 0; // reset array if ( AC_DomainArr.length > 0 ) { // if nothing selected, default to all if ( filter_domainnameSel.selectedIndex < 0 ) { filter_domainnameSel.selectedIndex = 0; CurrentDomainIndex = 1; // start with First } // If All else if ( filter_domainnameSel.selectedIndex == 0 ) { CurrentDomainIndex = 1; // start with First } // Specific Domain else { filter_domainname.value = AC_DomainArr[(filter_domainnameSel.selectedIndex * UserRecLength)]; } } var filter = processGetDomainAndFilterSpec(); if ( filter == "" ) { WinDomainIdx = 0; } else { MomText.innerHTML = ""; PopUpMoment.style.display = ""; top.Rstatus.Pstat("Searching Windows Domain/Workgroup-"+CurrentDomainEnumerated); MomText.innerHTML = "Searching Windows Domain/Workgroup-<br><b>'"+CurrentDomainEnumerated+"'</b><br>Total Found - <b>"+(EnumeratedServersArr.length/EnumeratedServersRecLength)+"</b>"; RpmCC_AC.GetEnumeratedServers(filter); } } else if ( DomainLUP.checked != false ) { WinDomainUsed = false; top.Rstatus.Pstat("Starting Domain Name Lookup"); } Tid = setTimeout("processServerDiscovery()",100); // delay and check again } // Initial Verify Button Processing function processVerifyButton() { var warr = new Array(); if ( processServiceSelectGet() == false ) // if invalid input return; // Check if at least one non-SQL selected if ( tpingchk != false || thttpchk != false || ttelchk != false || tftpchk != false || tsmtpchk != false || tpopchk != false || tdnschk != false || tuserchk != false || tsnmpchk != false) { // Make sure IP address is defined if ( AC_IPAddr.value == "" ) { alert("Please define an IP Address!"); AC_IPAddr.focus(); return; } SrchIdx = SrchIdxMax = 0; } else { // at most, just SQL checked SrchIdx = 1; SrchIdxMax = 0; } if ( toraclechk == false && tsqlchk == false && tpingchk == false && thttpchk == false && ttelchk == false && tftpchk == false && tsmtpchk == false && tpopchk == false && tlnoteschk == false && tdnschk == false && tuserchk == false && tsnmpchk == false) { alert("Please select one or more IP Services by clicking on the associated checkbox(s)!"); genchk.focus(); } else { ServiceSelect.style.display="none"; AC_ServerSel.style.display="none"; AC_DomainNSel.style.display="none"; AC_GroupSel.style.display="none"; AC_MIBSel.style.visibility="hidden"; ipaddrbase = AC_IPAddr.value; RespArIx = RespAR.length = 0; RespCount = 0; // reset response count ELogText.innerText = ""; // clear ELBgFlg = 0; // flag for alternating background color ELIdx = 0; // output log index ELChkBoxCount = -1; // flag Checkbox count as a Verify ELogHeader.innerText = "Server Verify Status"; ELogHeaderImg.src="images/verify.gif" processLogWindow(); ELogWinMain.style.display=""; SetButtonState(StopButton,"0"); bSelC.style.display = "none"; //SetButtonState(bSelC,"1"); bUselC.style.display = "none"; //SetButtonState(bUselC,"1"); bAdd.style.display = "none"; //SetButtonState(bAdd,"1"); SetButtonState(DiscoveryResetButton,"1"); SetButtonState(DiscoveryPrintButton,"1"); DiscoverWait.style.visibility="visible"; // if SQL verify is checked,initiate it if ( tsqlchk ) { top.Rstatus.Pstat("Verifying SQL Server Database Connect"); warr = tsqlparms.split(","); RpmCC_AC.SqlConnectVerify(warr[0],warr[1],warr[2],warr[3],tsqlto); SQL_DIP = true; } // if Oracle verify is checked,initiate it if ( toraclechk ) { top.Rstatus.Pstat("Verifying Oracle Database Connect"); warr = toracleparms.split(","); RpmCC_AC.SqlConnectVerify("OracleVerify[]"+ipaddrbase,warr[1],warr[2],warr[3],toracleto); ORACLE_DIP = true; } Tid = setTimeout("processServerDiscovery()",100); // delay and check again } } // Process the Discovery and Verify Pop-up Accordingly var SrchIdx=0, SrchIdxMax=0, RespArIx=0, RespCount=0, RespArLth=4; var svlookfor=""; var CurrentDiscoveryDomain = ""; function processServerDiscovery() { var warr = new Array(); Tid = null; // clear T/O ID if ( StopFlag == true ) { top.Rstatus.Pstat("Checking for IP Services Stopped"); finishUp(); return; } else if ( WinDomain_DIP ) { if ( WinDomainIdx < 0 || RespCount > 0 ) { Tid = setTimeout("processServerDiscovery()",100); // delay and check again return; } if ( WinDomainIdx >= EnumeratedServersArr.length-1 ) { WinDomain_DIP = false; if ( SrchIdx > SrchIdxMax ) { top.Rstatus.Pstat("Done Checking for IP Services"); finishUp(); return; } } } else if ( SQL_DIP ) { Tid = setTimeout("processServerDiscovery()",100); // delay and check again return; } else if ( ORACLE_DIP ) { Tid = setTimeout("processServerDiscovery()",100); // delay and check again return; } else if ( RespCount > 0 ) { // if waiting on responses from previous Tid = setTimeout("processServerDiscovery()",100); // delay and check again return; } else if ( SrchIdx > SrchIdxMax ) { top.Rstatus.Pstat("Done Checking for IP Services"); if ( ELChkBoxCount == -1 ) { // if this is a Verify processServiceSelectPut(); // be sure current display is correct } finishUp(); return; } RespCount=0; SetButtonState(StopButton,"0"); crip = crname = ""; // initialize response results var pntmo,htmo,ftmo,ttmo,smtmo,ptmo,dtmo,utmo,stmo,ltmo; if ( ELChkBoxCount == -1 ) { // if this is a Verify snmpc = tsnmpchk; warr = tsnmpparms.split(","); srqst = (warr[0] == "") ? "public" : warr[0]; srqst += (warr.length >= 5) ? "~"+warr[4] : ""; // OID srqst += (warr.length >= 4) ? "["+warr[3] : ""; // Look For pingc = tpingchk; httpc = thttpchk; thttpport = (thttpport == "") ? "80" : thttpport; hport = parseInt(thttpport,10); hport = (thttpsec) ? hport+0x10000 : hport; hlookfor = thttplookfor; hpageon = thttponpage; ftpc = tftpchk; tftpport = (tftpport == "") ? "21" : tftpport; fport = parseInt(tftpport,10); fport = (tftpsec) ? fport+0x10000 : fport; telc = ttelchk; tport = (ttelport == "") ? "23" : ttelport; tport = parseInt(ttelport,10); tport = (ttelsec) ? tport+0x10000 : tport; smtpc = tsmtpchk; tsmtpport = (tsmtpport == "") ? "25" : tsmtpport; sport = parseInt(tsmtpport,10); sport = (tsmtpsec) ? sport+0x10000 : sport; popc = tpopchk; tpopport = (tpopport == "") ? "110" : tpopport; pport = parseInt(tpopport,10); pport = (tpopsec) ? pport+0x10000 : pport; dnsc = tdnschk; tdnsport = (tdnsport == "") ? "53" : tdnsport; dnsp = parseInt(tdnsport,10); dnsnme = (tdnsname == "") ? "www.breakoutsoft.com" : tdnsname; userc = tuserchk; tuserport = (tuserport == "") ? "100" : tuserport; userp = parseInt(tuserport,10); urqst = tuserrqst; uresp = tuserresp; lnotesc = tlnoteschk; tlnotesport = (tlnotesport == "") ? "1352" : tlnotesport; lnotesp = parseInt(tlnotesport,10); lrqst = tlnotesrqst; lresp = tlnotesresp; pntmo=tpingto, htmo=thttpto, ftmot=tftpto, ttmo=ttelto; smtmo=tsmtpto, ptmo=tpopto, dtmo=tdnsto, utmo=tuserto; stmo=tsnmpto, ltmo=tlnotesto; cip = ipaddrbase; cdname = cip; top.Rstatus.Pstat("Checking for IP Services at IP Address: "+cip); } else { // Discovery lnotesc = false; snmpc = snmpchk.checked; srqst = snmprqst.value svlookfor = ""; pingc = pingchk.checked; httpc = httpportchk.checked; hport = parseInt(httpport.value,10); hport = (httpschk.checked) ? hport+0x10000 : hport; hlookfor = ""; hpageon = ""; ftpc = ftpportchk.checked; fport = parseInt(ftpport.value,10); fport = (ftpschk.checked) ? fport+0x10000 : fport; telc = telportchk.checked; tport = parseInt(telport.value,10); tport = (telschk.checked) ? tport+0x10000 : tport; smtpc = smtpportchk.checked; sport = parseInt(smtpport.value,10); sport = (smtpschk.checked) ? sport+0x10000 : sport; popc = popportchk.checked; pport = parseInt(popport.value,10); pport = (popschk.checked) ? pport+0x10000 : pport; dnsc = dnsportchk.checked; dnsp = parseInt(dnsport.value,10); dnsnme = dnsname.value; userc = userportchk.checked; userp = parseInt(userport.value,10); urqst = userrqst.value; uresp = userresp.value; pntmo=pingdto.value, htmo=httpdto.value, ftmo=ftpdto.value, ttmo=teldto.value; smtmo=smtpdto.value, ptmo=popdto.value, dtmo=dnsdto.value, utmo=userdto.value; stmo=snmpdto.value; if ( WinDomain_DIP ) { CurrentDiscoveryDomain = EnumeratedServersArr[WinDomainIdx]; cip = EnumeratedServersArr[WinDomainIdx+2]; cdname = crname = EnumeratedServersArr[WinDomainIdx+1]; if ( cip == "" ) { // no IP Address, try look up again cip = RpmMIL.ResolveNameToIPAddr(crname); if ( cip == "" ) { // still no IP Address, skip it WinDomainIdx += EnumeratedServersRecLength; Tid = setTimeout("processServerDiscovery()",100); // delay and check next return; } } top.Rstatus.Pstat("Checking for IP Services at Server: "+crname); } else { CurrentDiscoveryDomain = ""; cip = ipaddrbase+SrchIdx; if ( WinDomainUsed ) { for ( var i=0; i<EnumeratedServersArr.length-1; i+= EnumeratedServersRecLength ) { if ( cip == EnumeratedServersArr[i+2] ) { // if IP Address already checked ++SrchIdx; // bump to next Tid = setTimeout("processServerDiscovery()",100); // delay and check next return; } } } top.Rstatus.Pstat("Checking for IP Services at IP Address: "+cip); cdname = cip; } } if ( pingc != false ) { RespCount++; RespAR[RespArIx++] = RpmMIL.Ping(cip,1,parseInt(pntmo,10)); RespAR[RespArIx++] = cip; RespAR[RespArIx++] = "PING"; RespAR[RespArIx++] = cdname; } if ( httpc != false ) { RespCount++; RespAR[RespArIx++] = RpmMIL.HttpPage(cip,hport,parseInt(htmo,10),hpageon,hlookfor); RespAR[RespArIx++] = cip; RespAR[RespArIx++] = "HTTP"; RespAR[RespArIx++] = cdname; } if ( ftpc != false ) { RespCount++; RespAR[RespArIx++] = RpmMIL.FTP(cip,fport,parseInt(ftmo,10)); RespAR[RespArIx++] = cip; RespAR[RespArIx++] = "FTP"; RespAR[RespArIx++] = cdname; } if ( telc != false ) { RespCount++; RespAR[RespArIx++] = RpmMIL.TELNET(cip,tport,parseInt(ttmo,10)); RespAR[RespArIx++] = cip; RespAR[RespArIx++] = "TELNET"; RespAR[RespArIx++] = cdname; } if ( smtpc != false ) { RespCount++; RespAR[RespArIx++] = RpmMIL.Smtp(cip,sport,parseInt(smtmo,10)); RespAR[RespArIx++] = cip; RespAR[RespArIx++] = "SMTP"; RespAR[RespArIx++] = cdname; } if ( popc != false ) { RespCount++; RespAR[RespArIx++] = RpmMIL.Pop(cip,pport,parseInt(ptmo,10)); RespAR[RespArIx++] = cip; RespAR[RespArIx++] = "POP"; RespAR[RespArIx++] = cdname; } if ( dnsc != false ) { RespCount++; RespAR[RespArIx++] = RpmMIL.Dns(cip,dnsp,parseInt(dtmo,10),2,dnsnme); RespAR[RespArIx++] = cip; RespAR[RespArIx++] = "DNS"; RespAR[RespArIx++] = cdname; } if ( userc != false ) { RespCount++; RespAR[RespArIx++] = RpmMIL.User(cip,userp,parseInt(utmo,10),2,urqst,uresp,"1"); RespAR[RespArIx++] = cip; RespAR[RespArIx++] = "USER"; RespAR[RespArIx++] = cdname; } if ( snmpc != false ) { RespCount++; var SnmpUID = RpmCC_AC.SnmpDiscovery(cip,srqst,"1","0",stmo,"1"); RespAR[RespArIx++] = "A"+SnmpUID; RespAR[RespArIx++] = cip; RespAR[RespArIx++] = "SNMP"; RespAR[RespArIx++] = cdname; } if ( lnotesc != false ) { RespCount++; RespAR[RespArIx++] = RpmMIL.User(cip,lnotesp,parseInt(ltmo,10),2,lrqst,lresp,"1"); RespAR[RespArIx++] = cip; RespAR[RespArIx++] = "L_NOTES"; RespAR[RespArIx++] = cdname; } if ( WinDomain_DIP ) { WinDomainIdx += EnumeratedServersRecLength; } else { ++SrchIdx; // bump to next } Tid = setTimeout("processServerDiscovery()",100); // delay and check next } function finishUp() { SetButtonState(DiscoveryResetButton,"0"); SetButtonState(DiscoveryPrintButton,"0"); SetButtonState(StopButton,"1"); StopFlag = false; DiscoverWait.style.visibility="hidden"; if ( ELChkBoxCount != -1 ) { SetButtonState(bSelC,"0"); SetButtonState(bUselC,"0"); } } // Pop-up Button Processing, Cancel, Stop, Reset, Default function processCancelButton() { DomainFilter.style.display="none"; PopUpDiv.style.display="none"; ServiceSelect.style.display=""; AC_ServerSel.style.display=""; AC_DomainNSel.style.display=""; AC_GroupSel.style.display=""; AC_MIBSel.style.visibility="visible"; SetButtonState(CUpdateButton,"0"); SetButtonState(CResetButton,"0"); SetButtonState(InstallAgentButton,"0"); AddServicesFlag = 0; // reset SetButtonState(DiscoveryButton,"0"); } function processStopButton() { finishUp(); StopFlag = true; } function processDiscoveryResetButton() { top.Rstatus.Pstat(""); ELogWinMain.style.display="none"; //AC_ServerSel.style.display=""; AC_DomainNSel.style.display=""; AC_GroupSel.style.display=""; AC_MIBSel.style.visibility="visible"; ServiceSelect.style.display=""; processServiceSelectPut(); if (CMode == "New") { SetButtonState(DiscoveryButton,"0"); SetButtonState(VerifyButton,"0"); } } function processDefaultButton() { httpport.value = (httpschk.checked) ? "443" : "80"; ftpport.value = (ftpschk.checked) ? "990" : "21"; smtpport.value = (smtpschk.checked) ? "465" : "25"; popport.value = (popschk.checked) ? "995" : "110"; dnsport.value = "53"; userport.value = "100"; telport.value = (telschk.checked) ? "992" : "23"; } /* Process Click on an Discovery Entry or Select All/Unselect All Button*/ function processDiscoverySelect() { if ( event.srcElement.id == "bSelC" ) { // Check all Visible for (var i=0,j=0; j< VisibleCount; ++i ) { // Find each one if ( LogEventObjectArray[i].style.display == "" ) { // Check if visible LogEventCheckBoxObjectArray[i].checked = "checked"; ++j; } } if ( j > 0 ) { SetButtonState(bAdd,"0"); } ELChkBoxCount = j; // count of checked } else { // Uncheck all Visible for (var i=0,j=0; j< VisibleCount; ++i ) { // Find each one if ( LogEventObjectArray[i].style.display == "" ) { // Check if visible LogEventCheckBoxObjectArray[i].checked = ""; ++j; } } SetButtonState(bAdd,"1"); ELChkBoxCount = 0; } } function processCheckClick() { if ( document.all[event.srcElement.id].checked == "" ) { --ELChkBoxCount; } else { ++ELChkBoxCount; } if ( ELChkBoxCount != 0 ) { SetButtonState(bAdd,"0"); } else { SetButtonState(bAdd,"1"); } } // Print Discovery var DiscStatWindow = null; function processPrintDiscovery() { if ( !top.banner.IE55orBetter ) { alert("Print requires IE 5.5/SP1 or greater. Download current, free IE update from Microsoft's web site"); return; } FakeBut.click(); // simulate event to call "savePageCoord(...)" var wprop = "height="+top.banner.bCh+",width="+top.banner.bCw wprop += ",top="+(top.banner.bY-28)+",left="+(top.banner.bX-4)+",scrollbars"; var rName = ""+Math.random(); // use Random number to get unique Window name rName = rName.substring(2,rName.length); DiscStatWindow = window.open("",rName,wprop); if ( DiscStatWindow == null ) { return; } var dh = "<html><head><title>MonitorIT - Server Discovery Status Report</title>"; dh += "<link rel='stylesheet' type='text/css' href='css/rpmstyle.css'></head><body"; dh += " title='Exit to Close Window when Printing is complete'>"; dh += ELogWin.innerHTML; dh += "<script LANGUAGE='JavaScript'>ploghdr.border='1'; window.focus();"; dh += "< /script>< /body>< /html>"; DiscStatWindow.document.open(); DiscStatWindow.document.write(dh); DiscStatWindow.document.close(); DiscStatWindow.print(); } function procHttpschk() { if ( httpschk.checked ) httpport.value = "443"; } function procFtpschk() { if ( ftpschk.checked ) ftpport.value = "990"; } function procSmtpschk() { if ( smtpschk.checked ) smtpport.value = "465"; } function procPopschk() { if ( popschk.checked ) popport.value = "995"; } function procTelschk() { if ( telschk.checked ) telport.value = "992"; } function procSecureChk() { if ( securechk.checked ) { var gpv = "0"; var ssi = ServiceSelect.selectedIndex; if ( ssi == 1 ) { gpv = "443"; } else if ( ssi == 2 ) { gpv = "990"; } else if ( ssi == 3 ) { gpv = "465"; } else if ( ssi == 4 ) { gpv = "995"; } else if ( ssi == 9 ) { gpv = "992"; } genport.value = gpv; } } // Enable IP Address Lookup Window Pop-up Window function processInstallAgentButton() { if ( AC_Name.value == "" ) { alert("Please specify the server/workstation machine name"); AC_Name.focus(); return; } SetButtonState(OKButtonAIP,"0"); // enable SetButtonState(CancelButtonAIP,"0"); saveButtonState(); AC_DomainNSel.style.visibility = "hidden"; PopUpAI.style.display=""; DefaultPathCheckbox.style.display = "none"; AIPath.value = CreateAIPath(AC_Name.value); } function processAIPCancelButton() { PopUpAI.style.display="none"; // disable pop-up if ( GlobalAIP ) { GlobalAIP = false; } else { AC_DomainNSel.style.visibility = ""; restoreButtonState(); if ( AC_NameSel.style.visibility != "hidden" && AC_NameSel.style.display == "" ) { AC_NameSel.focus(); } } } function processCheckBoxClick(th) { switch ( th.id ) { case "AC_SNMPEnabled" : if ( th.checked ) { if ( GotMIBData ) { SetButtonState(MIBObjectButton,"0"); } AC_MIBSel.className = ""; AC_ReadComm.className = ""; AC_SNMPPort.className = ""; AC_Collection.className = ""; } else { if ( CMode == "New" || confirm("Disabling SNMP Monitoring for this server/device will remove its\nassociated Objects/Counters and monitored Values from the database\nwhen you press the 'Save' button.\n\nAre you sure you want to disable SNMP Monitoring for this server/device?") ) { SetButtonState(MIBObjectButton,"1"); AC_MIBSel.className = "idis"; AC_ReadComm.className = "idis"; AC_SNMPPort.className = "idis"; AC_Collection.className = "idis"; } else { th.checked = "checked"; } } break; } } function processAIPOKButton() { if ( GlobalAIP ) { processGlobalAgentPath(); return; // Done if called from Manage Agents } SetButtonState(OKButtonAIP,"1"); // disable SetButtonState(CancelButtonAIP,"1"); if ( AC_DomainN.value == "" ) { AC_DomainN.value = AC_DomainNSel.options[AC_DomainNSel.selectedIndex].value; } var AI_arg = AIPath.value+"~"+AC_IPAddr.value+"~"; if ( AC_DomainArr.length == 0 ) { AI_arg += logon_username.value+"~"+logon_password.value+"~"+logon_domainname.value+"~"; } else { // Look for match on server/workstation name and a Domain name which is also a 'stand-alone' for ( var i=0; i<AC_DomainArr.length; i+=UserRecLength ) { if ( AC_DomainArr[i+5] == "3" && AC_DomainArr[i].toLowerCase() == AC_Name.value.toLowerCase() ) { // Match found on a stand-alone; use those Domain entry credentials AI_arg += AC_DomainArr[i+4]+"~" +AC_DomainArr[i+3]+"~"+AC_DomainArr[i]+"~"; break; } } if ( i >= AC_DomainArr.length ) { // no match on stand-alone; find match on Domain member var daidx=0; for ( var i=0; i<AC_DomainArr.length; i+=UserRecLength ) { if ( AC_DomainN.value == AC_DomainArr[i] ) { daidx = i; break; } } // Check if any credentials provided for matched Doamin if ( AC_DomainArr[daidx+4].length > 0 ) { AI_arg += AC_DomainArr[daidx+4]+"~"+AC_DomainArr[daidx+3]+"~"; } else { // otherwise use <All> credentials if any for the matched Domain AI_arg += AC_DomainArr[4]+"~"+AC_DomainArr[3]+"~"; } AI_arg += ( (daidx == 0) ? "" : AC_DomainArr[daidx] )+"~"; } } while ( AI_arg.length < 512 ) { AI_arg += AI_arg; } if ( RpmCC_AC.AgentInstall( AI_arg ) ) { alert("Unable to start the Agent Install/Update process"); top.Rstatus.Pstat("Unable to start the Agent Install/Update process",true); } else { // waiting for OperationCompleteEvent SetCursor("wait"); top.banner.processStartComm(); top.Rstatus.Pstat("One moment while Agent Install/Update proceeds",true); } AC_DomainNSel.style.visibility = ""; PopUpAI.style.display="none"; // disable pop-up } // Create new Window and load specified Page function processAdminGroupButton() { processPopUpSelect(11,false); return; } function processConfigAlertButton() { processPopUpSelect(1,false); return; } var viewToggle = 0; function processMonServerButton() { if ( viewToggle == 0 ) { viewToggle = 1; MonServerRow0.style.visibility = "visible"; MonServerRow1.style.visibility = "visible"; AC_ServerSel.style.display = (CMode == "New" || CMode == "Edit") ? "" : "none"; } else { viewToggle = 0; MonServerRow0.style.visibility = "hidden"; MonServerRow1.style.visibility = "hidden"; AC_ServerSel.style.display = "none"; } } // Print Log var DiscStatWindow = null; function processAgentPrintStatus() { if ( !top.banner.IE55orBetter ) { alert("Print requires IE 5.5/SP1 or greater. Download current, free IE update from Microsoft's web site"); return; } FakeBut.click(); // simulate event to call "savePageCoord(...)" var wprop = "height="+top.banner.bCh+",width="+top.banner.bCw wprop += ",top="+(top.banner.bY-28)+",left="+(top.banner.bX-4)+",scrollbars"; var rName = ""+Math.random(); // use Random number to get unique Window name rName = rName.substring(2,rName.length); DiscStatWindow = window.open("",rName,wprop); if ( DiscStatWindow == null ) { return; } var dh = "<html><head><title>MonitorIT - Manage Agent Status Report</title>"; dh += "<link rel='stylesheet' type='text/css' href='css/rpmstyle.css'></head><body"; dh += " title='Exit to Close Window when Printing is complete'>"; var warr = new Array(); warr = AgentWin.innerHTML.split("onclick"); dh += warr.join(""); dh += ' </body></html>'; DiscStatWindow.document.open(); DiscStatWindow.document.write(dh) DiscStatWindow.document.close(); DiscStatWindow.print(); } var savDN="", savPW="", savUN=""; function processLogonInfo() { if ( AC_DomainArr.length == 0 ) { logon_domainnameSel.style.display = "none"; logon_domainname.style.display = ""; LogonApplyButton.style.display = "none"; SpecifyText.style.display = ""; SelectText.style.display = "none"; savDN = logon_domainname.value; savPW = logon_password.value; savUN = logon_username.value; } else { logon_domainnameSel.style.display = ""; logon_domainname.style.display = "none"; LogonApplyButton.style.display = ""; SpecifyText.style.display = "none"; SelectText.style.display = ""; lth = logon_domainnameSel.length; for (i=0; i < lth; ++i) logon_domainnameSel.remove(0); for ( var i=0; i<AC_DomainArr.length; i+=UserRecLength ) { addElementToSelect(logon_domainnameSel,AC_DomainArr[i]+DtypTxt[parseInt(AC_DomainArr[i+5],10)]); } logon_username.value = AC_DomainArr[4]; logon_password.value = AC_DomainArr[3]; } AC_DomainNSel.style.visibility = "hidden"; AC_GroupSel.style.visibility = "hidden"; LogonInfo.style.display = ""; logon_username.focus(); } function processLogonOKButton() { processLogonApplyButton(); AC_DomainNSel.style.visibility = ""; AC_GroupSel.style.visibility = ""; LogonInfo.style.display = "none"; } function processLogonApplyButton() { var i = logon_domainnameSel.selectedIndex * UserRecLength; AC_DomainArr[i+3] = logon_password.value; AC_DomainArr[i+4] = logon_username.value; } function processDomainNameChange() { var i = logon_domainnameSel.selectedIndex * UserRecLength; logon_password.value = AC_DomainArr[i+3]; logon_username.value = AC_DomainArr[i+4]; } function processLogonCancelButton() { LogonInfo.style.display = "none"; AC_DomainNSel.style.visibility = ""; AC_GroupSel.style.visibility = ""; logon_username.value = savUN; logon_password.value = savPW; logon_domainname.value = savDN; } // For Test Purposes function processTestAddComputers() { for ( var i=0; i<500; i++ ) { AddServicesArr[i] = "192.168.1.117,Test"+i+200+",PING"; } CMode = "New"; AddServicesFlag = 2; // Add unconditionally AddServicesArrIdx = 0; TotalComputersAdded = 0; processAddComputers(); } function CreateAIPath(cname) { return "\\\\" + cname + "\\C$\\Program Files\\MonitorIT"; }