<%
/***********************************************************************************
*	Name			:EgToolKitUI.jsp
***********************************************************************************/
%>

<%@ page errorPage="EgProbs.jsp"%>
<%@ page import="java.util.StringTokenizer"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="com.egurkha.util.StringUtils"%>
<%@ page import="com.eg.EgInstallInfo"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

<%
	String reqFrom = request.getParameter("reqFrom");
	String tools = egurkha.EgUIUtils.encodeSecurityChar(request.getParameter("tools"));
	if(tools != null)
	{
		tools = com.eg.EgURLDecoder.decode(tools,"UTF-8");
	}
	String isValidTool = request.getParameter("isValidTool");

	String highLightNode =request.getParameter("highLightNode").trim();
	if (highLightNode == null || highLightNode.equalsIgnoreCase("null"))
	{
		highLightNode = "";
	}

	String strDecrypt = "";
	String strCsc = "";
	String strVdiuc = "";
	String strAggSup = "";
	String strDecryptText = "";
	String strChangeSMpwd = "";

	boolean isSuperManager = EgInstallInfo.isSuperManager; 
	String manager_label = isSuperManager ? "SuperManager" : "Manager";
	String license_file = isSuperManager ? "EgSMLicenseTrack.jsp":"EgLicenseTrack.jsp";

	ArrayList optionList = new ArrayList();
	optionList = StringUtils.egTokenizer(tools,",");
	if (isValidTool.equals("true") && optionList != null && optionList.size() > 0)
	{
		String tempData = "";
		for (int i=0;i< optionList.size();i++)
		{
			tempData = (String)optionList.get(i);
			if (tempData.equals("decrypt"))
			{
				strDecrypt = tempData;
			}
			else if (tempData.equals("cscdecrypt"))
			{
				strCsc = tempData;
			}
			else if (tempData.equals("vdiuc"))
			{
				strVdiuc = tempData;
			}
			else if (tempData.equals("aggsupport"))
			{
				strAggSup = tempData;
			}
			else if (tempData.equals("decrypttext"))
			{
				strDecryptText = tempData;
			}
			else if (tempData.equals("smpwd"))
			{
				strChangeSMpwd = tempData;
			}
		}
	}
%>

<html>
<head>
<title>
</title>
<LINK href="/final/admin/eg_styles/adminstyle_blue.css" type="text/css" rel="stylesheet">
<script language="javascript" src="/final/admin/eg_scripts/DiagnosisTree.js"></script>
</head>
<body style="overflow:auto;" class="padding4" scrolling="auto" >
	<div id="treeDiv">
		<script type="text/javascript">
		var isSuperManager = ('<%=isSuperManager%>' == 'true');
		var d = new dTree('d');
		d.add('0','-1','TROUBLESHOOTING TOOLKIT','','TROUBLESHOOTING TOOLKIT','MonitorView','','',true,-1);

		//Trouble Shooting Tree
		d.add('1','0','Database','','Database','MonitorView','','',true,-1);
		d.add('2','1','Connection At-A-Glance','./admin/EgConMon.jsp?comeFrom=ConnMon&sessionInUse=true','Connection At-A-Glance','MonitorView');
		//d.add('3','1','Connection - Detailed Analysis','./admin/EgConMon.jsp?details=true&comeFrom=ConnDet&sessionInUse=true','Connection - Detailed Analysis','MonitorView');
		d.add('4','1','Connection - StackTrace','./admin/EgConMon.jsp?trace=true&comeFrom=ConnTrace&sessionInUse=true','Connection - StackTrace','MonitorView');
		d.add('5','1','View Data','./admin/EgMon2.jsp?comeFrom=View&sessionInUse=true','View Data','MonitorView');
		if(!isSuperManager)
		{
			d.add('6','1','DB Utility','./admin/EgDbUtility.jsp?comeFrom=DBUtil&sessionInUse=true','DB Utility','MonitorView');
			d.add('7','1','Cleanup Summary','./admin/EgDbCleanup.jsp?comeFrom=Cleanup&sessionInUse=true','Cleanup Summary','MonitorView');
		}

		d.add('8','0','StackTrace','../final/misc/EgStack.jsp?comeFrom=Stack&sessionInUse=true','StackTrace','MonitorView');

		d.add('9','0','License','','License','MonitorView','','',true,-1);
		d.add('10','9','Usage','./admin/<%=license_file%>?comeFrom=License&sessionInUse=true','Usage','MonitorView');

		if ('<%=optionList%>' != null && '<%=strDecrypt%>' != null && '<%=strDecrypt%>' == "decrypt")
		{
			d.add('11','9','Decrypt Utility','./admin/EgLicenseReport.jsp?comeFrom=DecryptUtil&sessionInUse=true','Decrypt Utility','MonitorView');
		}

		if ('<%=optionList%>' != null && '<%=strCsc%>' != null && '<%=strCsc%>' == "cscdecrypt")
		{
			d.add('12','9','CSC Decrypt Utility','./admin/EgCSCLicenseReport.jsp?comeFrom=Csc&sessionInUse=true','CSC Decrypt Utility','MonitorView');
		}

		d.add('13','0','Configuration Files','','ConfigurationFiles','MonitorView','','',true,-1);
		d.add('14','0','Log Files','','LogFiles','MonitorView','','',true,-1);
		d.add('15','14','<%=manager_label%>','../final/misc/EgManagerLogView.jsp?comeFrom=ManagerLogs&sessionInUse=true','<%=manager_label%>','MonitorView');
		if(!isSuperManager)
		{
			d.add('16','14','Agent','../final/misc/EgAgentLogView.jsp?comeFrom=AgentLogs&sessionInUse=true','Agent','MonitorView');

			d.add('17','0','Agent Info (Cluster)','./admin/ReportingAgents.jsp?showAgents=true&comeFrom=AgentInfo&sessionInUse=true','Agent Info (Cluster)','MonitorView');

			d.add('18','0','Schedules','','Schedules','MonitorView','','',true,-1);
			d.add('19','18','Configuration','../final/config/ecSchedule.jsp?comeFrom=Schedule&sessionInUse=true','Configuration','MonitorView');
			d.add('20','18','Reporter','../final/reporter/Schedule.jsp?comeFrom=Reporter&sessionInUse=true','Reporter','MonitorView');
		}
		d.add('21','0','<%=manager_label%>/Tomcat Information','','Information','MonitorView','','',true,-1);
		d.add('22','21','<%=manager_label%> JDK/JVM Info','./admin/jdkversion.jsp?comeFrom=Jdk&sessionInUse=true','<%=manager_label%> Jdk version','MonitorView');
		d.add('23','21','Tomcat Server Info','./admin/TomcatInfo.jsp?comeFrom=tomcatInfo&sessionInUse=true','Tomcat Server Info','MonitorView');

		if ('<%=optionList%>' != null && '<%=strVdiuc%>' != null && '<%=strVdiuc%>' == "vdiuc")
		{
			d.add('24','0','VDI User Count','./admin/UserCountReport.jsp?comeFrom=VDI&sessionInUse=true','VDI User Count','MonitorView');
		}

		if ('<%=optionList%>' != null && '<%=strAggSup%>' != null && '<%=strAggSup%>' == "aggsupport")
		{
			d.add('25','0','Aggregate Tests','../final/misc/defaultAggTests.jsp?comeFrom=Agg&sessionInUse=true','Aggregate Tests','MonitorView');
		}

		d.add('26','0','Update Manual Configuration Changes','./admin/updateManConfig.jsp?comeFrom=UpdateManualConfig&sessionInUse=true','Update Manual Configuration Changes','MonitorView');
		if(!isSuperManager)
		{
			d.add('27','0','Metrics Catalog','./admin/metricsCatalog.jsp?comeFrom=MetricsCatalog&sessionInUse=true','Metrics Catalog','MonitorView');
			d.add('28','1','View Top Servers','./admin/EgViewTopServers.jsp?comeFrom=ViewTopServers&sessionInUse=true','View Top Servers','MonitorView');
		}

		d.add('29','13','Update','./admin/EgConfigFile.jsp?comeFrom=Config&sessionInUse=true','Update','MonitorView');

		d.add('30','13','Download','./admin/EgConfigFileDownload.jsp?comeFrom=ConfigFileDownload&sessionInUse=true','Download','MonitorView');
		if(!isSuperManager)
		{
			d.add('31','0','Component - Entity Mapping','./admin/EgComponentEntityMapping.jsp?comeFrom=ServiceNames&sessionInUse=true','Component - Entity Mapping','MonitorView');
		}
		if ('<%=optionList%>' != null && '<%=strDecryptText%>' != null && '<%=strDecryptText%>' == "decrypttext")
		{
			d.add('32','0','Decrypt Text','./admin/EgDecryptText.jsp?sessionInUse=true','Decrypt Text','MonitorView');
		}
		if(!isSuperManager)
		{
			d.add('33','0','Duplicate Agents IP Info','../final/monitor/FindDuplicateIPsOfAgents.jsp?sessionInUse=true&comeFrom=DuplicateIPCheck','DuplicateIPCheck','MonitorView');
		}
		d.add('34','0','Restart <%=manager_label%>/Enable Debugs','./admin/ManagerRestart.jsp?sessionInUse=true','Restart Manager/Enable Debugs','MonitorView');

		if('<%=optionList%>' != null && '<%=strChangeSMpwd%>' != null && '<%=strChangeSMpwd%>' ==  "smpwd")
		{
			d.add('35','0','Change egsm Password ','./admin/EgChangeSmPwd.jsp?sessionInUse=true','Change egsm Password ','MonitorView');
		}
		if(!isSuperManager)
		{
			d.add('36','1','Upload Diagnosis Statistics','./admin/EgUploadDiagnosisStatistics.jsp?comeFrom=UploadDiagnosis&sessionInUse=true','Upload Diagnosis Statistics','MonitorView');
		}
		document.write(d);
		if('<%=reqFrom%>' != null)
		{
			if('<%=reqFrom%>' == "ConGlance")
			{
				d.highlightNodeByProcess("Connection At-A-Glance");
				parent.frames[1].location.href = 'EgConMon.jsp?comeFrom=ConnMon&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "ConDetails")
			{
				d.highlightNodeByProcess("Connection - Detailed Analysis");
				parent.frames[1].location.href = 'EgConMon.jsp?details=true&comeFrom=ConnDet&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "ConTrace")
			{
				d.highlightNodeByProcess("Connection - StackTrace");
				parent.frames[1].location.href = 'EgConMon.jsp?trace=true&comeFrom=ConnTrace&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "ViewData")
			{
				d.highlightNodeByProcess("View Data");
				parent.frames[1].location.href = 'EgMon2.jsp?comeFrom=View&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "DBUtility")
			{
				d.highlightNodeByProcess("DB Utility");
				parent.frames[1].location.href = 'EgDbUtility.jsp?comeFrom=DBUtil&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "DbCleanup")
			{
				d.highlightNodeByProcess("Cleanup Summary");
				parent.frames[1].location.href = 'EgDbCleanup.jsp?comeFrom=Cleanup&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "StackTrace")
			{
				d.highlightNodeByProcess("StackTrace");
				parent.frames[1].location.href = '../misc/EgStack.jsp?comeFrom=Stack&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "Usage")
			{
				d.highlightNodeByProcess("Usage");
				parent.frames[1].location.href = '<%=license_file%>?comeFrom=License&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "decrypt")
			{
				d.highlightNodeByProcess("Decrypt Utility");
				parent.frames[1].location.href = 'EgLicenseReport.jsp?comeFrom=DecryptUtil&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "cscdecrypt")
			{
				d.highlightNodeByProcess("CSC Decrypt Utility");
				parent.frames[1].location.href = 'EgCSCLicenseReport.jsp?comeFrom=Csc&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "ConfigFiles")
			{
				d.highlightNodeByProcess("Update");
				parent.frames[1].location.href = 'EgConfigFile.jsp?comeFrom=Config&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "ManagerLogs")
			{
				d.highlightNodeByProcess("Manager");
				parent.frames[1].location.href = '../misc/EgManagerLogView.jsp?comeFrom=ManagerLogs&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "AgentLogs")
			{
				d.highlightNodeByProcess("Agent");
				parent.frames[1].location.href = '../misc/EgAgentLogView.jsp?comeFrom=AgentLogs&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "AgentCluster")
			{
				d.highlightNodeByProcess("Agent Info (Cluster)");
				parent.frames[1].location.href = 'ReportingAgents.jsp?showAgents=true&comeFrom=AgentInfo&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "Configuration")
			{
				d.highlightNodeByProcess("Configuration");
				parent.frames[1].location.href = '../config/ecSchedule.jsp?comeFrom=Schedule&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "Reporter")
			{
				d.highlightNodeByProcess("Reporter");
				parent.frames[1].location.href = '../reporter/Schedule.jsp?comeFrom=Reporter&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "Jdkversion")
			{
				d.highlightNodeByProcess("Manager JDK/JVM Info");
				parent.frames[1].location.href = 'jdkversion.jsp?comeFrom=Jdk&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "TomcatInfo")
			{
				d.highlightNodeByProcess("Tomcat Server Info");
				parent.frames[1].location.href = 'TomcatInfo.jsp?comeFrom=TomcatInfo&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "vdiuc")
			{
				d.highlightNodeByProcess("VDI User Count");
				parent.frames[1].location.href = 'UserCountReport.jsp?comeFrom=VDI&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "aggsupport")
			{
				d.highlightNodeByProcess("Aggregate Tests");
				parent.frames[1].location.href = '../misc/defaultAggTests.jsp?comeFrom=Agg&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "UpdateManualConfig")
			{
				d.highlightNodeByProcess("Update Manual Configuration Changes");
				parent.frames[1].location.href = 'updateManConfig.jsp?comeFrom=UpdateManualConfig&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "MetricsCatalog")
			{
				d.highlightNodeByProcess("Metrics Catalog");
				parent.frames[1].location.href = 'metricsCatalog.jsp?comeFrom=MetricsCatalog&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "ViewTopServers")
			{
				d.highlightNodeByProcess("View Top Servers");
				parent.frames[1].location.href = 'EgViewTopServers.jsp?comeFrom=ViewTopServers&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "ConfigFileDownload")
			{
				d.highlightNodeByProcess("Download");
				parent.frames[1].location.href = 'EgConfigFileDownload.jsp?comeFrom=ConfigFileDownload&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "ServiceNames")
			{
				d.highlightNodeByProcess("Component - Entity Mapping");
				parent.frames[1].location.href = 'EgComponentEntityMapping.jsp?comeFrom=ServiceNames&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "decrypttext")
			{
				d.highlightNodeByProcess("Decrypt Text");
				parent.frames[1].location.href = 'EgDecryptText.jsp?sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "DuplicateIPCheck")
			{
				d.highlightNodeByProcess("Duplicate Agents IP Info");
				parent.frames[1].location.href = '../monitor/FindDuplicateIPsOfAgents.jsp?sessionInUse=true&comeFrom=DuplicateIPCheck';
			}
			else if('<%=reqFrom%>' == "RestartManager")
			{
				d.highlightNodeByProcess("Restart <%=manager_label%>/Enable Debugs");
				parent.frames[1].location.href = 'ManagerRestart.jsp?sessionInUse=true&comeFrom=RestartManager';
			}
			else if('<%=reqFrom%>' == "smpwd")
			{
				d.highlightNodeByProcess("Change egsm Password ");
				parent.frames[1].location.href = 'EgChangeSmPwd.jsp?comeFrom=smpwd&sessionInUse=true';
			}
			else if('<%=reqFrom%>' == "UploadDiagnosis" )
			{
				d.highlightNodeByProcess("Upload Diagnosis Statistics");
				parent.frames[1].location.href = 'EgUploadDiagnosisStatistics.jsp?comeFrom=UploadDiagnosis&sessionInUse=true';
			}
		}
		</script>
		<table border="0" cellpadding="2" cellspacing="0">
			<tr>
				<td><a class="eg_adminlink" href="javascript:void(0);" onclick="d.oAll(true);">Expand All</a></td>
				<td>&nbsp;|&nbsp;</td>
				<td><a class="eg_adminlink" href="javascript:void(0);" onclick="d.oAll(false);">Collapse All</a></td>
			</tr>
		</table>
	</div>
</body>
</html>



