<!DOCTYPE html>

<%
/************************************************************************************************
*	File				: ErUserLogonDetailsReportPrint.jsp
*	Version			:	1.0
*	Author			:	Arul Edward J
*	Creation Date	:	26/05/14 
*
*************************************************************************************************/
%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ include file="ErTracker.jsp"%>
<%@ page import="com.eg.EgDbInfo"%>
<%@ page import="com.eg.EgMappingInfo"%>
<%@ page import = "java.text.SimpleDateFormat" %>
<%@ page import = "java.text.DateFormat" %>
<%@ page import="com.eg.EgReportInfo"%>
<%@ page import="com.eg.EgTablesInfo"%>
<%@ page import = "com.eg.EgConfigInfo"%>
<%@ page import = "com.egurkha.util.DateUtil" %>
<%@ page import="egurkha.reporter.*"%>
<%@ page import="com.eg.EgDateInfo"%>
<%@ page import="com.eg.* "%>
<%@ page import="java.net.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.egurkha.User"%>
<%@ page import="com.egurkha.util.DateTimeTokenizer"%>
<%@ page import="com.egurkha.util.DateUtil"%>
<%@ taglib prefix="egui" uri="../WEB-INF/eg-taglib.tld"%>
<%@ page import="com.egurkha.util.StringUtils"%>
<%@ page import = "net.sf.json.*" %>
<%@ page import = "java.util.regex.Matcher"%>
<%@ page import = "java.util.regex.Pattern"%>
<%!
	public static int logOnDurationTestFreq=5;
	String currentDateFormat =null;
	boolean isViewSummary=false;
%>
<%!
	private static final String BLANK_SPACE = " ";
	private static final String COMA = ",";
	private static final String COLON = ":";
	private static final String PIE = "|";
	private static final String BSLASH = "/";
	private static final String UTF_8 = "UTF-8";
%>
<%
	Map resultMap = null;
	Map dataMap = null;
	String er_aggregateValue =request.getParameter("er_aggregateValue");			
	String uppermajor =request.getParameter("uppermajor");			
	String upperCritical =request.getParameter("upperCritical");			
	String er_option =request.getParameter("er_option");			
	if(er_option == null || (er_option!=null && er_option.isEmpty()))
	{
		 er_option = "Zone";
	}	
	String er_dataFrom =request.getParameter("er_dataFrom");
	String er_service = request.getParameter("er_service");
	if(er_dataFrom!=null && (er_dataFrom.equalsIgnoreCase("Segment")||er_dataFrom.equalsIgnoreCase("Service")||er_dataFrom.equalsIgnoreCase("Zone")))
	{
		if(er_service!=null)
		{
			er_option=er_dataFrom;				
		}
	}
	else if(er_dataFrom!=null && er_dataFrom.equalsIgnoreCase("Component"))
	{
		er_option=er_dataFrom;			
	}
	currentDateFormat = strUserDateFormat;
	String pdfPrint = request.getParameter("pdfprint");
	String titleToDisplay=request.getParameter("er_RmDispName");
	String s_st_date = request.getParameter("startdate");
	String s_en_date = request.getParameter("enddate");
	String s_st_hr = request.getParameter("starthr");
	String s_en_hr = request.getParameter("endhr");
	String strmin = request.getParameter("startmin");
	String enmin = request.getParameter("endmin");
	String rtype =request.getParameter("er_type");
	String searchUser = request.getParameter("er_tapplication");
	String er_mode = request.getParameter("er_mode");
	String timefrom2=request.getParameter("timefrom");
	String minfrom2=request.getParameter("minfrom");
	String timeto2=request.getParameter("timeto");
	String minto2=request.getParameter("minto");
	String fontStyleDblSingl = "";
	String s_comptype = request.getParameter("er_comptype");
	String er_component[] = request.getParameterValues("er_component");
	String sample = request.getParameter("sample");
	resultMap = (HashMap) session.getAttribute("USER_LOGON_REPORT");
	String er_componentType=request.getParameter("er_componentType");
	String enableAggregation =request.getParameter("enableAggregation");
	String er_brokeringFrom=request.getParameter("er_brokeringFrom");
	String includeReconnects=request.getParameter("er_inclReconnect");
	if (includeReconnects == null || includeReconnects.equals(""))
		includeReconnects="Yes";
	if(includeReconnects != null){
		if(!(includeReconnects.equalsIgnoreCase("Yes") || includeReconnects.equalsIgnoreCase("No")))
			includeReconnects="Yes";
	}
	ErUtils erUtils1 =new ErUtils();
	String s_application[] = request.getParameterValues("er_user");
	if(s_application!=null && s_application.length>0)
	{
		for(int cnt=0;cnt<s_application.length;cnt++)
		{
			String strApp = s_application[cnt];
			if(strApp!=null && strApp.length()>0)
			{
				strApp = erUtils1.specialCharDecode(strApp);
			}
			s_application[cnt] = strApp;
		}
	}
	String majorValue=request.getParameter("uppermajor");
	String minorValue=request.getParameter("upperminor");
	String criticalValue=request.getParameter("upperCritical");
	String select_farm=request.getParameter("select_farm");
	

	try 
	{
		//For Time Zone Conversion
		EgTimeZoneConverter timeZoneConverterStart = null;
		EgTimeZoneConverter timeZoneConverterEnd = null;
		String startDateForDisplay = null;
		String startHourForDisplay = null;
		String endDateForDisplay = null;
		String endHourForDisplay = null;
		String startMinForDisplay = null;
		String endMinForDisplay = null;

		User userName=UserRegistry.getInstance().getUser(session.getId());

		String mngrIP= new IniFile(new EgConfigInfo("manager").getDbFile()).getValue("DB_PROPERTIES","ManagerUrl");
		String strManagerURL = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort();
		EgDbInfo dbInfo = new EgDbInfo("manager");
		EgMappingInfo intlmap = null;
		if (thisuser != null) 
		{
			intlmap = new EgMappingInfo(thisuser.getLanguage());
		}
		if ((dbInfo.doubleByteEnabled || !thisuser.getLanguage().equals("en_US"))&& !(pdfPrint != null
						&& pdfPrint.equalsIgnoreCase("yes") || (sample != null && !sample.equalsIgnoreCase("yes"))))
		{
			fontStyleDblSingl = "multi_font";
		} 
		else
		{
			fontStyleDblSingl = "";
		}
		EgReportInfo reportInfo = new EgReportInfo("manager");
		EgTablesInfo tablesInfo = new EgTablesInfo("manager");
		ErUtils erUtils = new ErUtils();
	
		List lst = new LinkedList();
		Vector vec1 = new Vector();
		List lst_dat1 = new LinkedList();
		
		if(titleToDisplay==null)
			titleToDisplay="USERLOGON REPORT";
    
	    String needLogonDetailsTableStr = reportInfo.getValue("USER_LOGON_REPORT","needLogonDetailsTable");
		boolean needLogonDetailsTable = true;
		if(needLogonDetailsTableStr!=null && needLogonDetailsTableStr.equalsIgnoreCase("No"))
		{
			needLogonDetailsTable = false;
		}
	    String usrLogons = reportInfo.getValue("USER_LOGON_REPORT","CtxXcXAEuemTest:User Logons");
            String serverCol = reportInfo.getValue("USER_LOGON_REPORT","CtxXcXAEuemTest:Server Start-up");
            String clientCol = reportInfo.getValue("USER_LOGON_REPORT","CtxXcXAEuemTest:Client Start-up");
            String header    = reportInfo.getValue("USER_LOGON_REPORT","CtxXcXAEuemTest:Header");
		int designCnt = 10000;
		try
		{
			String changedDesCnt = reportInfo.getValue("USER_LOGON_REPORT","countForChangedDesign");
			if(changedDesCnt!=null && changedDesCnt.length()>0)
			{
				designCnt = Integer.parseInt(changedDesCnt);
			}
		}
		catch(Exception e)
		{
			designCnt = 10000;
			e.printStackTrace();
		}
        
		String usrLogonsArr []    = (usrLogons!=null) ? usrLogons.split(",") : null;
		String serverColArr []    = (serverCol!=null) ? serverCol.split(",") : null;
		String clientColArr []    = (clientCol!=null) ? clientCol.split(",") : null;
		String headerArr []       = (header!=null) ? header.split(",") : null;
                String enableDetailedData = request.getParameter("eDd");
  
if(majorValue==null || majorValue.length()==0)
		majorValue=reportInfo.getValue("USER_LOGON_REPORT","majorValue");
	if(minorValue==null || minorValue.length()==0)
		minorValue=reportInfo.getValue("USER_LOGON_REPORT","minorValue");
	if(criticalValue==null || criticalValue.length()==0)
		criticalValue=reportInfo.getValue("USER_LOGON_REPORT","criticalValue");
	String enableDetailedDataCHECK = reportInfo.getValue("USER_LOGON_REPORT","enableDetailedDataCHECK");
    enableDetailedDataCHECK = "No".equalsIgnoreCase(enableDetailedDataCHECK)? "No":"Yes";
%>

<!Doctype html>
<head>
<%
	if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
	{
%>
	<title>&nbsp; <egui:intnl text="reporter.common.Reporter" />
	&nbsp; &nbsp; <egui:intnl text="reporter.common.Print" /> &nbsp;</title>
<%
	}
	else
	{
%>
	<title>&nbsp; <egui:intnl text="reporter.common.Reporter" />
	&nbsp; &nbsp;</title>
<%
	}
%>

<meta name="Author" content="">
<meta  charset="UTF-8">

<!-- <link rel="stylesheet" type="text/css" href="/final/reporter/styles/printpagestyle.css" /> -->
<link rel="stylesheet" type="text/css" href="/final/resources/css/ext-eg.css" />
	<link rel="stylesheet" type="text/css" href="../../final/styles/eGLightThemeIcons.css" />
	<link rel="stylesheet" type="text/css" href="../../final/reporter/styles/printpagestyle.css" />

<style>
.newPlainTable{
	background-color:#ffffff;
	border:1px solid #cdcdcd;
}
.iconTotalSessions, .iconUniquePools, .iconUniqueUsers, .iconUniqueProtocols, .iconDuration{
	background : url("../images/Light/sessionUsageIcons_reporter.png") no-repeat top left;
}
.iconTotalSessions{background-position:0px 0px !important; width:24px; height:24px;}
.iconUniquePools{background-position:-24px 0px !important; width:24px; height:24px;}
.iconUniqueUsers{background-position:-48px 0px !important; width:24px; height:24px;}
.iconUniqueProtocols{background-position:-72px 0px !important; width:24px; height:24px;}
.iconDuration{background-position:-96px 0px !important; width:24px; height:24px;}
.newPlainTable div:first-child{
	border-bottom:1px solid #c4c4c4;
	padding:0px 0px 5px 0px;
	margin:10px 10px 0px 10px;
}

.newPlainTable div:nth-child(2){
	display:block;
	margin:0px 0px 0px 10px;
	padding:5px 0px 5px 0px;
}

.newPlainTable div:nth-child(2) table{
	width:100%;
}

.newPlainTable div:nth-child(2) table tbody tr td:first-child{
	padding:5px 10px 5px 0px;
	width:80%;
	vertical-align:top;
}

.newPlainTable div:nth-child(2) table tr td:nth-child(2){
	padding:5px 10px 5px 0px;
	width:20%;
	vertical-align:top;
}

.reporterUserLogonDefault{
  -webkit-border-radius:2px;
    -moz-border-radius:2px;
    -ms-border-radius:2px;
    -o-border-radius:2px;
    border-radius:2px;
    background-color:#3d95b0;
	color:#ffffff;
	padding:4px;
	display:inline-block;
	z-index:9;
	line-height:140%;
	margin:2px 0 0 0;
}
.reporterUserLogonLow{
 -webkit-border-radius:2px;
    -moz-border-radius:2px;
    -ms-border-radius:2px;
    -o-border-radius:2px;
    border-radius:2px;
    background-color:#d9af54;
	color:#ffffff;
	width:60%;
	display:inline-block;
	z-index:9;
	line-height:140%;
	margin:2px 0 0 0;
}
.reporterUserLogonNormal{
 -webkit-border-radius:2px;
    -moz-border-radius:2px;
    -ms-border-radius:2px;
    -o-border-radius:2px;
    border-radius:2px;
    background-color:#1fc1b7;
	color:#ffffff;
	width:60%;
	display:inline-block;
	z-index:9;
	line-height:140%;
	margin:2px 0 0 0;
}
.reporterUserLogonMedium{
 -webkit-border-radius:2px;
    -moz-border-radius:2px;
    -ms-border-radius:2px;
    -o-border-radius:2px;
    border-radius:2px;
    background-color:#fd9f53;
	color:#ffffff;
	width:60%;
	display:inline-block;
	z-index:9;
	line-height:140%;
	margin:2px 0 0 0;
}
.reporterUserLogonHigh{
 -webkit-border-radius:2px;
    -moz-border-radius:2px;
    -ms-border-radius:2px;
    -o-border-radius:2px;
    border-radius:2px;
    background-color:#f57e7e;
	color:#ffffff;
	width:60%;
	display:inline-block;
	z-index:9;
	line-height:140%;
	margin:2px 0 0 0;
}
.sessionStartUpDesign {
	border:1px solid #cdcdcd
}
.sessionStartUpDesign tbody tr td {
	border-bottom:1px solid #cdcdcd;
	padding:5px 2px 5px 10px;
	line-height:2.0;
}
.newTable table tbody tr td {border-bottom:1px solid #cdcdcd;padding:4px 10px 1px 10px;font-size:11px;
line-height:14px !important;}
</style>

</head>
<body marginwidth="20" marginheight="20" bgcolor="#FFFFFF" style="margin:20px;">

<!--<table border="0" cellspacing="0" cellpadding="0" width="100%" style="table-layout:fixed;">
	<tr>
		<td width="100%" align="center" height="100%" valign="top">	-->

<%
	String strLogCls = "printHeaderBoxLogo";
	if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
	{
		strLogCls = "printHeaderBoxLogo";
	}
	else
		strLogCls = "printPdfHeaderBoxLogo";

	if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
	{
%>
		<div class="<%=strLogCls%>" style="padding:10px"><img src="<%=imageName%>" border="0" /></div> 
<%
	}
	else
	{
%>
		<div class="<%=strLogCls%>"><img src="<%=imageName%>" border="0" /></div> 
<%
	}
%>
			
			<!--<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center"  style="border-bottom:1px solid #999;">
				<tr>
					<td style="padding:2px">   -->
					<div class="printHeaderBox">
<%
	if (!StringUtils.isNull(titleToDisplay))
	{
%>
						<div class="printHeaderBoxTitle"><%=titleToDisplay%></div>
<%
	}
	else
	{
%>
						<div class="printHeaderBoxTitle"> <egui:intnl text="reporter.common.USER LOGON REPORT " /></div>
<%
	}
	if (pdfPrint != null && pdfPrint.equalsIgnoreCase("yes")) 
	{
%>
						<div class="printHeaderBoxPrintIcon" style="float:left"><img class="iconPrinter mouse"  src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" border="0" onClick="javascript:print()" alt='<egui:intnl text="reporter.common.PRINT"/>' title='<egui:intnl text="reporter.common.PRINT"/>'/></div>
<%
	}
%>
				</div>
					<!--</td> <br/>
				</tr>
			</table>-->

			<!--<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" style="border-bottom:1px solid #ccc;">
				<tr>
					<td align="left" valign="top" width="50%"> -->
						<!--<div style="float:left;padding:4px;">
							<div style="float:left" class="formLabel"><egui:intnl text="reporter.common.UserLogon Report" /></div>
							<div style="float:left;width:10px" align="center" >-</div>
							<div style="float:left;" class="formValue"><%= intlmap.getComponentTypeDescription(s_comptype) %></div>
						</div>-->
<div class="printOuterBoxNoBorder">
<div class="printSelectionFields" ><egui:intnl text="reporter.common.User Logon Report"/> - <span class="bold"><%= intlmap.getComponentTypeDescription(s_comptype) %></span></div>
				<!--	</td>
					<td align="right" valign="top">-->
<%
	if(er_option != null && !er_option.equalsIgnoreCase("component")){
		
%>
	<div class="printSelectionFields" ><%=er_option%> - <span class="bold"><%=select_farm%></span></div>
<%
	}
	if(er_component != null && er_component.length > 0 && er_component.length <= 2){
		String cmpName="";
		for(int n=0;n<er_component.length;n++){
			String tmpVar=er_component[n];
			if(tmpVar != null && tmpVar.indexOf(":") > -1)
				tmpVar=tmpVar.substring(0,tmpVar.indexOf(":"));
			if(n == 0)
				cmpName=tmpVar;
			else
				cmpName+=", "+tmpVar;
		}
%>
	<div class="printSelectionFields" ><egui:intnl text="reporter.common.Server"/> - <span class="bold"><%=cmpName%></span></div>
<%

	}
	String dispStart = "";
	String dispEnd = "";
	//dispStartDate=start_date.trim()+" "+erd.s_sthr+":"+erd.s_startmin;
	dispStart = s_st_date + " " + s_st_hr + COLON + strmin ;
	dispEnd = s_en_date + " " + s_en_hr + COLON + enmin ;
	//Time zone Conversion
		
		timeZoneConverterStart = new EgTimeZoneConverter(dispStart ,userName);
		startDateForDisplay = (String) timeZoneConverterStart.getDate(false);
		startHourForDisplay = timeZoneConverterStart.getHour();
		startMinForDisplay = timeZoneConverterStart.getMinute();

		timeZoneConverterEnd = new EgTimeZoneConverter(dispEnd ,userName);
		endDateForDisplay = (String) timeZoneConverterEnd.getDate(false);
		endHourForDisplay = timeZoneConverterEnd.getHour();
		endMinForDisplay = timeZoneConverterEnd.getMinute();

		String pdfStartDate=startDateForDisplay+" "+startHourForDisplay+":"+startMinForDisplay;
		String pdfEndDate = endDateForDisplay+" "+endHourForDisplay+":"+endMinForDisplay;

	Vector dvec = new Vector();
	String stimefmt =	pdfStartDate+ " hrs";
	String etimefmt =	pdfEndDate+ " hrs";
	dvec.add('"'+"Start Time : "+stimefmt+'"');
	dvec.add('"'+"End Time : "+etimefmt+'"');
	lst.add(dvec);
	String s_tit2= "User Logon Analysis ";
	if(s_comptype!=null)
		s_tit2+="for "+intlmap.getComponentTypeDescription(s_comptype);
	if(er_option!=null && !er_option.equalsIgnoreCase("component"))
		lst.add("User Logon Details for "+er_option+" : "+request.getParameter("select_farm"));
	lst.add(s_tit2);
%>
						<!--<div style="float:right;padding:4px;">
							<div style="float:left" class="formLabel"> <egui:intnl text="reporter.common.Start Date" /></div>
							<div style="float:left;width:10px" align="center" >:</div>
							<div style="float:left;" class="formValue"> <%=stimefmt%></div>
						</div>
						<div style="clear:both;float:right;padding:4px;">
							<div style="float:left" class="formLabel"><egui:intnl text="reporter.common.End Date" /></div>
							<div style="float:left;width:10px" align="center">:</div>
							<div style="float:left;" class="formValue"><%=etimefmt%></div>
						</div>-->
						<div class="printSelectionFields">Timeline - <span class="bold"><%=stimefmt%>&nbsp; to <%=etimefmt%>&nbsp;</span></div>

					<!--</td>
				</tr>
			</table><br>-->
		<!--</td>
	</tr>
</table><br/>-->  
</div>
<div class="printOuterBox">
<%
		String queryString =(String)ErUtils.prepareQueryString(request.getParameterMap());	
		String Qstring="";		
		if (rtype != null && rtype.equalsIgnoreCase("yes"))
		{
			if(queryString!=null)
			{
				StringTokenizer strtok = new StringTokenizer(queryString,"&");
				while(strtok.hasMoreTokens())
				{
					String param = strtok.nextToken();
					int ind = param.indexOf("=");
					if (ind < 0 || param.indexOf("responseType")>-1)
						continue;
					String reqparam =param.substring(0,ind);
					String value = param.substring(ind+1);
					value=com.eg.EgURLEncoder.encode(value, "UTF-8");
					
					if (rtype != null && rtype.equalsIgnoreCase("No"))
					{
						if(reqparam.equalsIgnoreCase("opt"))
							value="Graph";
					}
					if(!reqparam.equalsIgnoreCase("er_view"))
						Qstring=Qstring+reqparam+"="+value+"&";
				}		
			}
			
%>	 	 
		<table width="100%" cellpadding="0" cellspacing="0" align="center" style="margin-top:5px">
		
		<tr>
			 <td><div class="printOuterBoxHeader"><egui:intnl text="reporter.common.User Logon Analysis" /></div></td>
		</tr>
		<%
			String servlet1 = "/final/servlet/com.eg.ErUserLogonDetailsReportC;jsessionid=" + session.getId() + "?isChartRequest=true&er_width=400&er_height=250&chartFor=distribution&" + Qstring;			
		%>
		
			<tr>
				<td align="center">	<div class="printOuterBox">
					<img src="<%= strManagerURL + servlet1 %>" style="border=0;" frameborder="0"/>
				</div>
				<div class="clearDiv">&nbsp;</div>
				</td>
			</tr>
		<%
					servlet1 = "/final/servlet/com.eg.ErUserLogonDetailsReportC;jsessionid=" + session.getId() + "?isChartRequest=true&er_width=850&er_height=350&chartFor=Topgraph&"+Qstring;
		%>
			<tr>
				<td align="center"><div class="printOuterBox">
					<img src="<%= strManagerURL + servlet1 %>" style="border=0;" frameborder="0"/>
				</div></td>
			</tr>
		</table>
	
<%
		}
		else if(s_comptype!=null && (s_comptype.equalsIgnoreCase("Horizon_Pod")||s_comptype.equalsIgnoreCase("VMware_View_server")))
		{
			JSONObject resultMapJson = (JSONObject)session.getAttribute("USER_LOGON_REPORT_POD");
			HashMap graphDatas=new HashMap();
			if(resultMapJson!=null)
			{
				String noDataStr = (String)resultMapJson.get("NO_DATA");
				//rootJson.put("compType",s_CompType);
				if(er_option!=null && !er_option.equalsIgnoreCase("component"))
				{
					lst.add("User Logon Details for "+er_option+" : "+request.getParameter("select_farm"));
				}
				if(noDataStr!=null && noDataStr.equalsIgnoreCase("No"))
				{
					//rootJson.put("NO_DATA",false);
					JSONObject summaryObj = new JSONObject();
					String Avg_Logons = (String)resultMapJson.get("Avg_Logons");
					summaryObj.put(intlmap.getTextDescription("reporter.common.Total Pool(s)"),(String)resultMapJson.get("Total_Pools")+"#iconUniquePools");
					summaryObj.put(intlmap.getTextDescription("reporter.common.Total Logons"),(String)resultMapJson.get("Total_Logons")+"#iconWebLogIn");
					summaryObj.put(intlmap.getTextDescription("reporter.common.Avg Logon Duration (secs)"), erUtils.round((Double.parseDouble(Avg_Logons)),0)+"#iconSessionHighIdleTime");
					summaryObj.put(intlmap.getTextDescription("reporter.common.Unique Users"),resultMapJson.get("Unique_User")+"#iconLogonUser");
					summaryObj.put(intlmap.getTextDescription("reporter.common.Unique Servers/Desktops"), resultMapJson.get("Desktop_Server_Count")+"#iconClientName");

					if(summaryObj != null)
					{
%>
			<div class="printOuterBox">
				<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.Overview"/></div>
				<table width="100%">
					<tr>
<%
						Iterator itr = summaryObj.keySet().iterator();
						while (itr.hasNext())
						{
							String keys = (String)itr.next();
							String valuesInfo = (String)summaryObj.get(keys);
							String iconclass = "";
							if(valuesInfo.indexOf('#')>-1)
							{
								iconclass = valuesInfo.substring(valuesInfo.indexOf('#')+1);
								valuesInfo = valuesInfo.substring(0,valuesInfo.indexOf('#'));
							}
%>
						<td align="center" width="20%" ><table><tr><td align="right" style="padding-right:5px"><div class="<%=iconclass%>"></div></td><td style="text-align:left;padding-left:5px" class="newFont_bold28"><%=valuesInfo%></td></tr><tr><td style="text-align:center;padding: 5px;" colspan="2"><span class="newFont_normal13" ><%=keys%></span></td></tr></table></td> 
<%
						}
%>
					</tr>
				</table>
<%
					}

					JSONArray summaryTableColumns = (JSONArray)resultMapJson.get("summaryTableColumns");
					JSONArray summaryTableDataList = (JSONArray)resultMapJson.get("summaryTableDataList");
					JSONObject logonDistributionGrpah = (JSONObject)resultMapJson.get("logonDistributionGrpah");
					JSONObject DistributionGraph = (JSONObject)resultMapJson.get("DistributionGraph");
					JSONObject columns = (JSONObject)resultMapJson.get("columns");
					JSONArray gridData = (JSONArray)resultMapJson.get("gridData");
					JSONObject gbObj = (JSONObject)resultMapJson.get("GROUP_DATA_GP_DATA");
					if(gbObj != null && gbObj.size() == 0)
					{
						gbObj = null;
					}
					graphDatas.put("logonDurationBrkupGrpah",logonDistributionGrpah);
					graphDatas.put("distributionGrpah",DistributionGraph);
					session.setAttribute("GraphDatas",graphDatas);
%>
		</div>
		<div style="margin-top:10px" class="printOuterBox">
			<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.Overview by Desktop pools"/></div>
			<div class="newTable" style="padding: 5px 0px 10px 0px;">
				<table width="100%">
					<thead>
						<tr>
<%
					lst_dat1 = new LinkedList();
					vec1 = new Vector();
					for(int la=0;la<summaryTableColumns.size();la++)
					{
						String str_1=(String)summaryTableColumns.get(la);
						String cols = (String)summaryTableColumns.get(la);
						if(cols!=null && cols.indexOf("<br/>")>-1)
						{
							cols = com.egurkha.util.StringUtils.replace(cols,"<br/>"," ");
						}
						vec1.add(cols);
						if(la==0)
						{
%>
							<th><%=str_1%></th>
<%
						}
						else
						{
%>
							<th style="text-align: center;"><%=str_1%></th>
<%
						}
					}
%>
						</tr>
					</thead>
					<tbody>
<%
					for(int la=0;la<summaryTableDataList.size();la++)
					{
%>
						<tr>
<%
						JSONArray strAry=(JSONArray)summaryTableDataList.get(la);
						for(int u=0;u<strAry.size();u++)
						{
							if(u==0)
							{
%>
							<td><%=strAry.get(u)%></td>
<%
							}
							else
							{
%>
							<td style="text-align:center;"><%=strAry.get(u)%></td>
<%
							}
						lst_dat1.add(strAry.get(u)+"");
						}
%>
						</tr>
<%
					}
					Hashtable sen11 = new Hashtable();
					sen11.put(vec1,lst_dat1);		
					Hashtable ht11=new Hashtable();
					ht11.put("Summarize by pools",sen11);
					lst.add(ht11);
%>
					</tbody>
				</table>
			</div>
		</div>
		<div style="padding-bottom: 5px;">
			<table width="100%">
				<tr>
					<td width="50%" style="padding:10px 5px 0px 0px;">
						<div class="printOuterBox">
						<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.Logon Performance Distribution" /></div>
<%
					String strUrl="../../final/servlet/com.eg.ErCitrixSessionLogonServletC;jsessionid="+session.getId()+"?isGraphReq=true&chartType=donut&chartReqFor=logonDurationBrkupGrpah&imagereq=yes&er_width=250&er_height=250";
%>		
							<table width="100%">
								<tr>
									<td width="60%">
										<div style="float:right;"><img src="<%=strUrl%>" /></div>
									</td>
									<td width="40%" valign="middle">
										<table>
<%
					JSONObject detailsObj=(JSONObject)graphDatas.get("logonDurationBrkupGrpah");
					JSONObject obj=null;
					if(detailsObj!=null)
					{
						JSONArray legArr=(JSONArray)detailsObj.get("legendArray");
						if(legArr!=null)
						{
							for(int k=0;k<legArr.size();k++)
							{
								obj=(JSONObject)legArr.get(k);
%>
											<tr><td style="padding-right: 5px;" ><div style="height:7px;width:7px;-webkit-border-radius:4px;background-color:<%=(String)obj.get("color")%>"></div></td><td><%=(String)obj.get("name")%>&nbsp;(<%=(String)obj.get("percent")%>%)</td></tr>
<%
							}
						}
					}
%>
										</table>
									</td>
								</tr>
							</table>
						</div>
					</td>
					<td width="50%" style="padding:10px 0px 0px 5px;">
						<div class="printOuterBox">
							<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.Total Logons vs Avg Logon Duration" /></div>
		<%
				strUrl="../../final/servlet/com.eg.ErCitrixSessionLogonServletC;jsessionid="+session.getId()+"?isGraphReq=true&chartType=donut&chartReqFor=distributionGrpah&imagereq=yes&er_width=430&er_height=250";
		%>		
							<div align="center"><img src="<%=strUrl%>" /></div>
						</div>
					</td>
				</tr>
			</table>
		</div>
<%
					// form Csv data and Main table
					lst_dat1 = new LinkedList();
					vec1 = new Vector();
					Iterator itrs = columns.keySet().iterator();
					String key="";
%>
		<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.Session Startup Analysis"/></div>
			<div class="newTable" style="padding: 5px 0px 10px 0px;">
				<table width="100%">
					<thead>
						<tr>
<%
					int u=0;
					while(itrs.hasNext())
					{
						key = (String)itrs.next();
						String vals = (String)columns.get(key);
						if(vals!=null && vals.indexOf("<br/>")>-1)
						{
							vec1.add(com.egurkha.util.StringUtils.replace(vals,"<br/>"," "));
						}
						else
						{
							vec1.add(vals);
						}
						if(u<2)
						{
%>
							<th width="<%=100/columns.size()%>%"><%=vals%></th>
<%
						}
						else
						{
%>
							<th style="text-align:center;" width="<%=100/columns.size()%>%"><%=vals%></th>
<%
						}
						u++;
					}
%>
						</tr>
					</thead>
					</tbody>
<%
					for(int i=0;i<gridData.size();i++)
					{
						String rowcolr="#ffffff";
						if(i%2 != 0)
							rowcolr="#f9f9f9";
						else
							rowcolr="#ffffff";
%>
						<tr>
<%
						JSONObject tempAry = (JSONObject)gridData.get(i);
						String compKey = "";
						String stDate = (String)tempAry.get("MSMT_TIME_DB");
						String host = (String)tempAry.get("TRGT_HOST");
						String user = (String)tempAry.get("USERNAME");
						String des_compType = (String)tempAry.get("DESKTOP_COMPTYPE");
						if(user.indexOf("\\")>-1)
						{
							//user = com.egurkha.util.StringUtils.replace(user,"\\","\\\\");
						}
						String desktop = (String)tempAry.get("DESKTOP");
						if(gbObj!=null)
						{
							String gpDurationData = reportInfo.getValue("USER_LOGON_REPORT",des_compType+"_newTable_GPDuration_Splitup");
							String gpData="";
							if(gpDurationData != null && gpDurationData.indexOf("$") > -1)
								gpData=gpDurationData.substring(gpDurationData.indexOf("$")+1);
							ArrayList gpLst = ErUtils.egTokenizer(gpData, ",");
							if(stDate != null && host != null && desktop != null && user!=null)
							{
								compKey=stDate.trim()+"#"+host.trim()+"#+"+user.trim()+"_on_"+desktop;
							}
							else if(stDate!=null)
							{
								compKey=stDate;
							}
							if(gbObj.containsKey(compKey))
							{
								JSONArray jdnnn = (JSONArray)gbObj.get(compKey);
								JSONArray gpHeader = null;
								JSONArray gpDetailsArr = new JSONArray();
								for(int z=0;z < jdnnn.size();z++)
								{
									JSONObject jsnnnn = (JSONObject)jdnnn.get(z);
									JSONObject objGp=new JSONObject();
									if(gpLst != null)
									{
										for(int k=0;k<gpLst.size();k++)
										{
											String str1=(String)gpLst.get(k);
											String strVal1=str1;
											if(str1 != null && str1.indexOf("#") > -1){
												strVal1=str1.substring(str1.indexOf("#")+1);
												str1=str1.substring(0,str1.indexOf("#"));
											}
											if(gpHeader == null)
											{
												gpHeader=new JSONArray();
												gpHeader.add(strVal1);
											}
											String str2 = (String)jsnnnn.get(str1);
											try
											{
												if(str2 != null)
												{
													double dd = Double.parseDouble(str2);
													if(dd < 0)
													{
														str2="-";
													}
												}
											}
											catch(Exception ee){}
											objGp.put(strVal1,str2);
										}
									}
									gpDetailsArr.add(objGp);
								}

								if(tempAry != null && tempAry.size() > 0){
									gpHeader=new JSONArray();
									for(int k=0;k<gpLst.size();k++){
										String str1=(String)gpLst.get(k);
										if(str1 != null && str1.indexOf("#") > -1)
										{
											str1=str1.substring(str1.indexOf("#")+1);
										}
										gpHeader.add(str1);
									}
									JSONObject objGp=new JSONObject();
									objGp.put("Header",gpHeader);
									objGp.put("Datas",gpDetailsArr);
									tempAry.put("GPDetails",objGp);
								}
							}
						}
						itrs = tempAry.keySet().iterator();
						int um = 0;
						while(itrs.hasNext())
						{
							key = (String)itrs.next();
							Object vals = (Object)tempAry.get(key);
							if(vals instanceof JSONObject)
							{
%>
							</tr>
							<tr style="background-color:<%=rowcolr%>">
								<td colspan="<%=columns.size()%>" style="border:0px">
								<div>
									<table width="100%" style="border:0px">
										<tr style="background:none">
											<td width="50%" valign="top" style="border:0px;padding:0px">
												<div style="margin:10px 10px 10px 0px;" class="newPlainTable">
													<div class="font_bold12"><egui:intnl text="reporter.common.Logon Time Break-up (secs)"/></div>
													<div style="height:155px;overflow:auto;">
														<table style="border:0px">
		<%
								JSONObject arr1 = (JSONObject)tempAry.get("logonBreakup");
								Iterator itr1 = arr1.keySet().iterator();
								while(itr1.hasNext())
								{
									String key1 = (String)itr1.next();
									String value1 = (String)arr1.get(key1);
									if(i==0)
									{
										vec1.add(key1);
									}
									lst_dat1.add(value1);
		%>
										<tr style="background:none"><td style="border:0px"><%=key1%></td><td style="border:0px"><%=value1%></td></tr>
		<%
								}
		%>
														</table>
													</div>
												</div>
											</td>
											<td width="50%" valign="top" style="border:0px;padding:0px">
												<div style="margin:10px 0px 10px 0px;" class="newPlainTable">
													<div class="font_bold12"><egui:intnl text="reporter.common.Group policy Time Break-up (secs)"/></div>
													<div style="height:155px;overflow:auto;">
														<table style="border:0px">
		<%
								arr1 = (JSONObject)tempAry.get("logonBreakup");
								itr1 = arr1.keySet().iterator();
								while(itr1.hasNext())
								{
									String key1 = (String)itr1.next();
									String value1 = (String)arr1.get(key1);
									if(i==0)
									{
										vec1.add(key1);
									}
									lst_dat1.add(value1);
		%>
										<tr style="background:none"><td style="border:0px"><%=key1%></td><td style="border:0px"><%=value1%></td></tr>
		<%
								}
		%>
														</table>
													</div>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</td>
						</tr>
<%
								if(tempAry != null && tempAry.containsKey("GPDetails"))
								{
									JSONObject gpBreakup = (JSONObject)tempAry.get("GPDetails");
									JSONArray gphdr=(JSONArray)gpBreakup.get("Header");
									JSONArray gridGpDatas=(JSONArray)gpBreakup.get("Datas");
%>
						<tr style="background-color:<%=rowcolr%>;border:0px" >
							<td colspan="<%=columns.size()%>" style="border:0px">
								<div class="font_bold12"><egui:intnl text="reporter.common.Details of client side extensions"/></div>
								<div class="newTable" style="padding: 5px 0px 10px 0px;">
									<table width="100%" style="border:1px solid #cdcdcd;border-bottom:0px">
										<thead>
											<tr>
<%
							lst_dat1.add(" ");
							lst_dat1.add(" ");
							lst_dat1.add(" ");
							lst_dat1.add("Details of client side extensions");
							for(int uv=0;uv<vec1.size()-4;uv++)
							{
								lst_dat1.add(" ");
							}
							lst_dat1.add(" ");
							for(int c=0;c<gphdr.size();c++)
							{
								String hdrStr=(String)gphdr.get(c);
								lst_dat1.add(hdrStr);
%>
												<th><%=hdrStr%></th>
<%
							}
							for(int uv=0;uv<vec1.size()-gphdr.size()-1;uv++)
							{
								lst_dat1.add(" ");
							}
%>
											</tr>
										</thead>
										<tbody>
<%
							for(int c=0;c<gridGpDatas.size();c++)
							{
								lst_dat1.add(" ");
								JSONObject hdrObj=(JSONObject)gridGpDatas.get(c);
%>
											<tr>
<%
								for(int j=0;j<gphdr.size();j++)
								{
									String hdrStr=(String)gphdr.get(j);
									lst_dat1.add(hdrStr);
%>
												<td><%=(String)hdrObj.get(hdrStr)%></td>
<%
								}
								for(int uv=0;uv<vec1.size()-gphdr.size()-1;uv++)
								{
									lst_dat1.add(" ");
								}
%>

											</tr>
<%
							}
%>
										</tbody>
									</table>
								</div>
							</td>
						</tr>
<%									
								}
								break;
							}
							else
							{
								if(!columns.containsKey(key))
								{
									continue;
								}
								String valsStr = (String)vals;
								String alignInfo = "left";
								String strPaddingStyle = "";
								if(valsStr != null && valsStr.indexOf("$$") > -1)
								{
									String tmp=valsStr.substring(valsStr.indexOf("$$")+2);
									valsStr=valsStr.substring(0,valsStr.indexOf("$$"));
									String divClassName="";
									if(tmp != null && tmp.equalsIgnoreCase("critical"))
										divClassName = "reporterUserLogonHigh";
									else if(tmp != null && tmp.equalsIgnoreCase("major"))
										divClassName = "reporterUserLogonMedium";
									else if(tmp != null && tmp.equalsIgnoreCase("minor"))
										divClassName =  "reporterUserLogonLow";
									else if(tmp != null && tmp.equalsIgnoreCase("normal"))
										divClassName = "reporterUserLogonNormal";
									else
										divClassName="reporterUserLogonDefault";
									lst_dat1.add(valsStr);
									valsStr="<div style='text-align:center' class='"+divClassName+"'>"+valsStr+"</div>";
									alignInfo="center";
									strPaddingStyle="padding:15px 10px 3px 10px;";
								}
								else
								{
									lst_dat1.add(valsStr);
									if(um>2)
									{
										strPaddingStyle+="text-align:center;";
									}
								}
%>
								<td align=<%=alignInfo%> style="border-bottom:0px;<%=strPaddingStyle%>"><%=valsStr%></td>
<%
							}
							um++;
						}
					}
				}
				else
				{
%>
			<table align="center" width="97%" cellspacing="0" cellpadding="4"   border="0">
				<tr>
					<table width='100%' height='100%'><tr>	<td align='center' valign='middle'><img src='/images/Light/nomeasures_custom.png' /></td></tr></table>
				</tr>
			</table>
<%
				}
			}
			else
			{
%>
			<table align="center" width="97%" cellspacing="0" cellpadding="4"   border="0">
				<tr>
					<table width='100%' height='100%'><tr>	<td align='center' valign='middle'><img src='/images/Light/nomeasures_custom.png' /></td></tr></table>
				</tr>
			</table>
<%
			}
		}
		else
		{
//			Map dataMap = (Map)resultMap.get("USER_LOGON_DATA");
			Map dirDataMap = (Map)resultMap.get("USER_LOGON_FOR_DIRTDATA");
			List headerObject = new ArrayList();
			HashMap graphDatas=new HashMap();
//
			JSONObject threshObj=new JSONObject();
			threshObj.put("majorValue",majorValue);
			threshObj.put("minorValue",minorValue);
			threshObj.put("criticalValue",criticalValue);
			JSONObject detailsObj=null;
			JSONObject logonDetailsObj=null;
			JSONArray logonDetailsArr=null;
		String avgSlowLogon="";
		
		ErUserLogonDetailsReportBean userBean=new ErUserLogonDetailsReportBean();

	if(resultMap != null && resultMap.containsKey("SummaryDataForLogon")){
		JSONArray detailsArr = (JSONArray)resultMap.get("SummaryDataForLogon");
		if(er_componentType != null && er_componentType.equalsIgnoreCase("Citrix_XcXenApp_server"))
			detailsObj=userBean.getLogonDetails(detailsArr,threshObj,includeReconnects,intlmap);
		else
			detailsObj=userBean.getLogonDetails(detailsArr,threshObj,null,intlmap);

		JSONObject logonObject=null;
		String tdWidth="25%";
		if(s_comptype != null && s_comptype.equalsIgnoreCase("Citrix_XcXenApp_server"))
			tdWidth="20%";
		if(detailsObj != null && detailsObj.containsKey("logonDetailsData")){
			String overviewTitle="Overview";
			if(s_application != null && s_application.length == 1 && !s_application[0].equalsIgnoreCase("--All--") && !s_application[0].equalsIgnoreCase("*"))
				overviewTitle="Logon Performance for "+s_application[0];

			logonDetailsArr=(JSONArray)detailsObj.get("logonDetailsData");
			if(logonDetailsArr != null && logonDetailsArr.size() > 0){
		%>
			<div class="printOuterBox">
				<div class="printOuterBoxHeader"><egui:intnl text="<%="reporter.common."+overviewTitle%>"/></div>
				
				<table width="100%">
					<tr>
		<%
				for(int l=0;l<logonDetailsArr.size();l++){
					logonObject=(JSONObject)logonDetailsArr.get(l);
		%>
				<td align="center" width=<%=tdWidth%> ><table><tr><td align="right" style="padding-right:5px"><div class="<%=(String)logonObject.get("iconclass")%>"></div></td><td style="text-align:left;padding-left:5px" class="newFont_bold28"><%=(String)logonObject.get("value")%></td></tr><tr><td style="text-align:center;padding: 5px;" colspan="2"><span class="newFont_normal13" ><%=(String)logonObject.get("name")%></span></td></tr></table></td> 
		<%
				}
				if(s_comptype != null && s_comptype.equalsIgnoreCase("Citrix_XcXenApp_server")){
					if(detailsObj != null && detailsObj.containsKey("sessionreconnectGraph")){
						logonDetailsObj=(JSONObject)detailsObj.get("sessionreconnectGraph");
						graphDatas.put("reconnectGraph",logonDetailsObj);
					}
		%>
					<td align="center" width=<%=tdWidth%> >
		<%//ErCitrixSessionLogonServletC
				String strUrl="../../final/servlet/com.eg.ErCitrixSessionLogonServletC;jsessionid="+session.getId()+"?isGraphReq=true&chartType=donut&chartReqFor=reconnectGraph&imagereq=yes&er_width=90&er_height=90";
				JSONArray dataSet = (JSONArray)logonDetailsObj.get("DataSet");
				JSONArray data = (JSONArray)((JSONObject)dataSet.get(0)).get("data");
				String ReConnectVal = ((JSONObject)data.get(0)).get("y")+"";
				String connectVal = ((JSONObject)data.get(1)).get("y")+"";
		%>		
						<table width="100%"><tr><td width="60%"><div align="center" style="margin-top: -25px;"><img src="<%=strUrl%>" /></div></td>
						<td width="40%" valign="top"><div><table align="center"><tbody><tr><td><div style="height:7px;width:7px;-webkit-border-radius:4px;background-color:#ffc76b"></div></td><td>&nbsp;Connect&nbsp;</td><td>&nbsp;(<%=connectVal%>)</td></tr><tr><td><div style="height:7px;width:7px;-webkit-border-radius:4px;background-color:#00aaa0"></div></td><td>&nbsp;Reconnect</td><td>&nbsp;(<%=ReConnectVal%>)</td></tr></tbody></table></div></td></tr></table>
					</td>
		<%
				}
		%>
					</tr>
				</table>
			</div>
		<%
			}
		}//logonDistributionGrpah
		if(detailsObj != null && detailsObj.containsKey("logonDistributionGrpah")){

			logonDetailsObj=(JSONObject)detailsObj.get("logonDistributionGrpah");
			graphDatas.put("logonDurationBrkupGrpah",logonDetailsObj);
		}
		if(detailsObj != null && detailsObj.containsKey("avgSlowLogonDuration")){
			avgSlowLogon=(String)detailsObj.get("avgSlowLogonDuration");
		}
	}
		if(resultMap != null && resultMap.containsKey("SummaryDataForTrendGrph")){
			JSONArray detailsArr=(JSONArray)resultMap.get("SummaryDataForTrendGrph");
			//
			SimpleDateFormat sdfrmt=new SimpleDateFormat(currentDateFormat);
			long daysCnt=0;
			try{
				java.util.Date dte1=sdfrmt.parse(pdfStartDate);
				java.util.Date dte2=sdfrmt.parse(pdfEndDate);
				long diff = dte2.getTime() - dte1.getTime();
				daysCnt=(diff/(1000 * 60 * 60 * 24));
			}
			catch(Exception ee){}
			//
			detailsObj=userBean.getDistributionGraphData(detailsArr,daysCnt,currentDateFormat);
			graphDatas.put("distributionGrpah",detailsObj);
		}
		if(resultMap != null && resultMap.containsKey("PIE_CHART_DATA"))
		{
			JSONObject pieChartData=(JSONObject)resultMap.get("PIE_CHART_DATA");
			if(pieChartData!=null && pieChartData.containsKey("graphDataNew"))
			{
			//	String avgSlowLogon="25";
				logonDetailsObj=(JSONObject)pieChartData.get("graphDataNew");
				String donutTitle="<span align='center' style=\"font-size:28px;font-family:Roboto;font-weight:400;\">"+avgSlowLogon+"</span>";
				String donutSubTitle="<span style=\"font-size:12px;font-family:Roboto;font-weight:400;\">secs</span>";
				logonDetailsObj.put("title",donutTitle);
				logonDetailsObj.put("subTitle",donutSubTitle);
				logonDetailsObj.put("isDoNutTitleNeeded","true");
				graphDatas.put("logonStartupBreakdown",logonDetailsObj);
			}
		}
		//
		session.setAttribute("GraphDatas",graphDatas);
		%>
			<div style="padding-bottom: 5px;">
				<table width="100%">
					<tr>
						<td width="50%" style="padding:10px 5px 0px 0px;">
							<div class="printOuterBox">
								<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.Logon Performance Distribution" /></div>
		<%//ErCitrixSessionLogonServletC
				String strUrl="../../final/servlet/com.eg.ErCitrixSessionLogonServletC;jsessionid="+session.getId()+"?isGraphReq=true&chartType=donut&chartReqFor=logonDurationBrkupGrpah&imagereq=yes&er_width=250&er_height=250";
		%>		
									<table width="100%">
										<tr>
											<td width="60%">
												<div style="float:right;"><img src="<%=strUrl%>" /></div>
											</td>
											<td width="40%" valign="middle">
												<table>
			<%
							detailsObj=(JSONObject)graphDatas.get("logonDurationBrkupGrpah");
							if(detailsObj!=null)
							{
								JSONArray legArr=(JSONArray)detailsObj.get("legendArray");
								JSONObject obj=null;
								for(int k=0;k<legArr.size();k++){
									obj=(JSONObject)legArr.get(k);
			%>
							<tr><td style="padding-right: 5px;" ><div style="height:7px;width:7px;-webkit-border-radius:4px;background-color:<%=(String)obj.get("color")%>"></div></td><td><%=(String)obj.get("name")%>&nbsp;(<%=(String)obj.get("percent")%>%)</td></tr>
			<%
								}
							}
			%>
											</table>
										</td>
									</tr>
								</table>
							</div>
						</td>
						<td width="50%" style="padding:10px 0px 0px 5px;">
							<div class="printOuterBox">
								<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.Total Logons vs Avg Logon Duration" /></div>
		<%//ErCitrixSessionLogonServletC
				strUrl="../../final/servlet/com.eg.ErCitrixSessionLogonServletC;jsessionid="+session.getId()+"?isGraphReq=true&chartType=donut&chartReqFor=distributionGrpah&imagereq=yes&er_width=430&er_height=250";
		%>		
								<div align="center"><img src="<%=strUrl%>" /></div>
							</div>
						</td>
					</tr>
				</table>
			</div>
		<%
		if(s_comptype!=null && !s_comptype.equalsIgnoreCase("Citrix_XcXenDesktop_Director")&& !s_comptype.equalsIgnoreCase("Citrix_XcXenDesktop_Site")&&!s_comptype.equalsIgnoreCase("Citrix_Cloud_Site"))
		{
			String sessionQryString=(String) session.getAttribute("USER_LOGON_Query_String");
			if(sessionQryString!=null)
				queryString=sessionQryString;
			if(queryString!=null)
			{
				StringTokenizer strtok = new StringTokenizer(queryString,"&");
				while(strtok.hasMoreTokens())
				{
					String param = strtok.nextToken();
					int ind = param.indexOf("=");
					if (ind < 0 || param.indexOf("responseType")>-1)
						continue;
					String reqparam =param.substring(0,ind);
					String value = param.substring(ind+1);
					if(reqparam.equals("startdate") || reqparam.equals("enddate") || reqparam.equals("inidate")|| reqparam.equals("pdfTime")|| reqparam.equals("select_testmes") || reqparam.equals("uid"))// for Session Startup Duration Trend graph in logon performance in print and pdf
					{
						// Because of double time encode
						value=com.eg.EgURLDecoder.decode(value,"UTF-8");
					}
					value=com.eg.EgURLEncoder.encode(value, "UTF-8");
					
					if (rtype != null && rtype.equalsIgnoreCase("No")){
						if(reqparam.equalsIgnoreCase("opt"))
							value="Graph";
					}
					
					if (rtype != null && rtype.equalsIgnoreCase("No")){
						if(!reqparam.equalsIgnoreCase("er_view"))
							Qstring=Qstring+reqparam+"="+value+"&";
					}
				}		
			}
			String test ="";	
			
			boolean isSummary=false;			
			if(er_aggregateValue==null || er_aggregateValue.equalsIgnoreCase("Details"))
			{
				isSummary=false;
				er_aggregateValue="Details";
			}
			else
			{
				isSummary=true;
			
			}
			String testKey=er_aggregateValue;
			if (resultMap != null && resultMap.containsKey("USER_LOGON_TEST_NAME"))
			{
					test=(String)resultMap.get("USER_LOGON_TEST_NAME");
			}
			
			if (resultMap != null && resultMap.containsKey("USER_LOGON_KEY")) 
			{
					testKey=(String)resultMap.get("USER_LOGON_KEY");
			}	
			String measureStr = reportInfo.getValue("USER_LOGON_REPORT",testKey+":"+test);

			StringTokenizer st = new StringTokenizer(measureStr,",");
			String queryStringForData= "/final/servlet/com.eg.ErCitrixSessionLogonServletC;jsessionid=" + session.getId() + "?isChartRequest=true&chartFor=Topgraph&"+Qstring;
			
			String subTitl2 = "Logon Duration Trend";
			if(s_comptype!=null && s_comptype.equals("Citrix_XcXenApp_server"))
			{
				subTitl2 = "Session Startup Duration Trend";
			}
			

			
%>

	<table align="center" cellspacing="0" cellpadding="0" width="100%">
		<tr>
			<td width="50%" style="padding: 5px 5px 0px 0px;">
				<div class="printOuterBox" >
				<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.Session Startup Duration Trend" /></div>
				<table align="center" cellspacing="0" cellpadding="0" width="100%">
					<tr>
						<td>
						<div><img src="<%=queryStringForData %>&er_width=430&er_height=250&optt=graph&er_view=IMAGE&isTimeReport=true" border="0" hspace="0" vspace="0" ></img></div>
						</td>
					</tr>
				</table>
				</div>
			</td>
			<td  style="valign:top;padding: 5px 0px 0px 5px;" valign="top" width="50%" >
	<%
		String subTitl3 = "Avg Session Startup Breakdown";

		if(s_comptype!=null && (s_comptype.equals("Citrix_XcXenDesktop_Director") || s_comptype.equalsIgnoreCase("Citrix_XcXenDesktop_Site")||s_comptype.equalsIgnoreCase("Citrix_Cloud_Site")))
		{
			subTitl3 = "Avg Logon Duration Breakdown";
		}


%>

						<div class="printOuterBox">
								<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.Avg Session Startup Breakdown" /></div>
		<%
		strUrl="../../final/servlet/com.eg.ErCitrixSessionLogonServletC;jsessionid="+session.getId()+"?isGraphReq=true&chartType=donut&chartReqFor=logonStartupBreakdown&imagereq=yes&er_width=250&er_height=250";
		%>		
									<table width="100%">
										<tr>
											<td width="60%">
												<div style="float:right;"><img src="<%=strUrl%>" /></div>
											</td>
											<td width="40%" valign="middle">
												<table>
			<%
							detailsObj=(JSONObject)graphDatas.get("logonStartupBreakdown");
							JSONObject obj=null;
							if(detailsObj!=null)
							{
								JSONArray legArr1=(JSONArray)detailsObj.get("legendArray");
								for(int k=0;k<legArr1.size();k++){
									obj=(JSONObject)legArr1.get(k);
			%>
							<tr><td style="padding-right: 5px;" ><div style="height:7px;width:7px;-webkit-border-radius:4px;background-color:<%=(String)obj.get("color")%>"></div></td><td><%=(String)obj.get("name")%>&nbsp;(<%=(Double)obj.get("val")%>)</td></tr>
			<%
								if(obj != null && obj.size() > 0 && obj.containsKey("innerArray")){
									JSONArray tmplegArray=(JSONArray)obj.get("innerArray");
									if(tmplegArray != null && tmplegArray.size() > 0){
										JSONObject tmpobj2=null;
										for(int m=0;m<tmplegArray.size();m++){
											tmpobj2=(JSONObject)tmplegArray.get(m);
											if(tmpobj2 != null && tmpobj2.size() > 0){
			%>
										
											<tr><td>&nbsp;</td><td>&nbsp;&nbsp;<%=(String)tmpobj2.get("name")%>&nbsp;(<%=(Double)tmpobj2.get("val")%>)</td></tr>
			<%
												}
											}
										}
									}
								}
							}
			%>
											</table>
										</td>
									</tr>
								</table>
							</div>




<%



		JSONObject legendObj=(JSONObject)session.getAttribute("USER_LOGON_DATA_CHARTLEGEND");
	%>
			</td>
		</tr>
	</table>


<%
	String titl1 = "";
	if(s_comptype!= null && s_comptype.equalsIgnoreCase("Citrix_XcXenApp_server"))
	{
		titl1 ="Session Startup Analysis (Secs)";
	}
	else
	{
		titl1 ="User Logon Analysis (Secs)";
	}
%>
</div>
<div>
<div class="prin tOuterBox" style="margin-top: 10px;">
	
<%
		if (resultMap != null && resultMap.containsKey("USER_LOGON_DATA_NEW") && needLogonDetailsTable)
		{
			JSONArray valuesArr = (JSONArray)resultMap.get("USER_LOGON_DATA_NEW");
			if(valuesArr != null && valuesArr.size() > 0){
				JSONObject gpObject=null;
				if(resultMap != null && resultMap.containsKey("GROUP_DATA_GP_DATA"))
					gpObject=(JSONObject)resultMap.get("GROUP_DATA_GP_DATA");
				String compTable=s_comptype;
				if(s_comptype != null && reportInfo.isVmComponent(s_comptype) && er_brokeringFrom != null && er_brokeringFrom.equalsIgnoreCase("Others"))
					compTable+="_newTable";
				detailsObj=userBean.getLogonDetailsGridData(valuesArr,gpObject,compTable,intlmap,currentDateFormat,isSummary,enableAggregation,threshObj,lst,thisuser);
				if(detailsObj != null && detailsObj.size() > 0){
					JSONArray colArray=(JSONArray)detailsObj.get("columns");
					JSONArray dataArray=(JSONArray)detailsObj.get("dataArray");
					
	
				}



				if(detailsObj != null && detailsObj.size() > 0)
				{
				JSONObject obj1=null; 
				JSONObject obj2=null; 
				JSONObject obj3=null; 
				JSONArray arr1=null; 
					JSONArray colArray=(JSONArray)detailsObj.get("columns");
					JSONArray dataArray=(JSONArray)detailsObj.get("dataArray");
				int dataCount = dataArray.size();
				int colArrayCount=0;
		%>
			<pd4ml-page-break/>
		<%
				if(dataCount < designCnt)
				{
		%>
			<div class="printOuterBox newTableDiv" style="padding:10px 0px 0px 0px;">
		<%
				}
		%>
				<div class="printOuterBoxHeader"><%=titl1 %></div>
		<%
					
					String rowcolr="#ffffff";
					for(int l=0;l<dataArray.size();l++){
						if(l%2 != 0)
							rowcolr="#f9f9f9";
						else
							rowcolr="#ffffff";
						
						obj1=(JSONObject)dataArray.get(l);
						if(l>0)
						{
%>
								<br/>
<%
						}
%>
<%
						if(dataCount < designCnt)
						{
%>
						<table width="100%" class="firstTable newimg" style="table-layout:fixed">
<%
						int colsize = 100/colArray.size();
						for(int la=0;la<colArray.size();la++){
%>
							<col width="<%=colsize%>%">
<%
						}
						if(l==0)
						{
%>
					<thead>
						<tr>
		<%
								for(int la=0;la<colArray.size();la++)
								{
						String str_1=(String)colArray.get(la);
									if(str_1 != null && (str_1.equalsIgnoreCase("USER NAME") || str_1.equalsIgnoreCase("SERVER") || str_1.equalsIgnoreCase("SESSION STARTUP TIME") || str_1.equalsIgnoreCase("CLIENT IP ADDRESS") || str_1.equalsIgnoreCase("CLIENT NAME")))
									{
		%>
							<th><%=str_1%></th>
		<%
									}else
									{
		%>
							<th style="text-align: center;"><%=str_1%></th>
		<%
						}
					}
		%>
						</tr>
					</thead>
<%
						}
						}
						else
						{
		%>
								<table width="100%" class="sessionStartUpDesign">
		<%
								colArrayCount = 0;
						}
%>
					<tbody>
						<tr style="background-color:<%=rowcolr%>">
		<%
						boolean isGpDetials =false;
						for(int k=0;k<colArray.size();k++)
						{
							String str1=(String)colArray.get(k);
							String strVl=(String)obj1.get(str1);
							String strPaddingStyle="";
							if(str1 != null && (str1.equalsIgnoreCase("Session start-up duration") || str1.equalsIgnoreCase("LOGON DURATION"))){
								if(strVl != null && strVl.indexOf("$$") > -1){
									String tmp=strVl.substring(strVl.indexOf("$$")+2);
									strVl=strVl.substring(0,strVl.indexOf("$$"));
									String divClassName="";
									if(tmp != null && tmp.equalsIgnoreCase("critical"))
										divClassName = "reporterUserLogonHigh";
									else if(tmp != null && tmp.equalsIgnoreCase("major"))
										divClassName = "reporterUserLogonMedium";
									else if(tmp != null && tmp.equalsIgnoreCase("minor"))
										divClassName =  "reporterUserLogonLow";
									else if(tmp != null && tmp.equalsIgnoreCase("normal"))
										divClassName = "reporterUserLogonNormal";
									else
										divClassName="reporterUserLogonDefault";
									strVl="<div class='"+divClassName+"' style='width:100%'>"+strVl+"</div>";
									strPaddingStyle="padding:15px 10px 3px 10px;";
								}
							}
							if(k>0 && colArrayCount%4==0 && dataCount >= designCnt)
							{
		%>
								</tr>
								<tr style="background-color:<%=rowcolr%>">
		<%
							}
							String tempStr1 = str1;
							tempStr1 = "<span class=font_bold12>"+tempStr1+"</span>";
							if(dataCount < designCnt)
							{
								if(str1 != null && (str1.equalsIgnoreCase("USER NAME") || str1.equalsIgnoreCase("SERVER") || str1.equalsIgnoreCase("SESSION STARTUP TIME") || str1.equalsIgnoreCase("CLIENT IP ADDRESS") || str1.equalsIgnoreCase("CLIENT NAME"))){
		%>
								<td align="center" style="border-bottom:0px;word-break:break-word"><%=strVl%></td>
		<%
								}else{
		%>
								<td align="center" style="border-bottom:0px;<%=strPaddingStyle%>"><%=strVl%></td>
		<%
								}
							}
							else
							{
								if(str1 != null && (str1.equalsIgnoreCase("USER NAME") || str1.equalsIgnoreCase("SERVER") || str1.equalsIgnoreCase("SESSION STARTUP TIME") || str1.equalsIgnoreCase("CLIENT IP ADDRESS") || str1.equalsIgnoreCase("CLIENT NAME"))){
		%>
									<td style="background-color:#e6e6e6;"><%=tempStr1%></td>
									<td style="<%=strPaddingStyle%>"><%=strVl%></td>
		<%				
								}else{
		%>
									<td style="background-color:#e6e6e6;"><%=tempStr1%></td>
									<td style="<%=strPaddingStyle%>"><%=strVl%></td>
		<%
								}
								colArrayCount++;
							}
						}
						if(dataCount < designCnt)
						{
		%>
						</tr>
		<%			
						}
						if(obj1 != null && obj1.containsKey("additionalDatas"))
						{
							obj2=(JSONObject)obj1.get("additionalDatas");
							arr1=(JSONArray)obj2.get("Server");
							if(dataCount < designCnt)
							{
		%>
						<tr style="background-color:<%=rowcolr%>">
							<td colspan="<%=colArray.size()%>" style="border-bottom:0px">
								<div>
									<table width="100%" style="border:0px">
										<tr style="background:none">
											<td width="50%" valign="top" style="border:0px;padding:0px">
												<div style="margin:10px 10px 10px 0px;" class="newPlainTable">
													<div class="font_bold12">Server Start up (secs)</div>
													<div>
														<table style="border:0px">
		<%
							}else
							{
								int tempCount = colArrayCount%4;
								if(tempCount != 0)
								{
									tempCount = 4 - tempCount;
								}
								for(int cnts=0;cnts<tempCount;cnts++)
								{
		%>
									<td></td>
									<td></td>
		<%
								}
		%>
								</tr>
								<tr>
									<td class="newFont_bold12" style="text-align:left;background-color:#f9f9f9" colspan="8"> Server Start up (secs) </td>
								</tr>
								<tr>
		<%
								colArrayCount = 0;
							}
							for(int z=0;z<arr1.size();z++)
							{
								obj3=(JSONObject)arr1.get(z);
								String key = (String)obj3.get("key"); 
								key = "<span class=font_bold12>"+key+"</span>";
								String value = (String)obj3.get("value"); 
								if(z > 0 && colArrayCount%4==0 && dataCount >= designCnt)
								{
		%>
									</tr>
									<tr>
		<%
								}
								if(dataCount < designCnt)
								{
		%>
										<tr style="background:none"><td style="border:0px;padding:4px 0px 2px 0px"><%=key%></td><td style="border:0px;padding:4px 0px 2px 0px"><%=value%></td></tr>
		<%
								}else
								{
		%>
										<td style="background-color:#e6e6e6;"><%=key%></td>
										<td><%=value%></td>
		<%
										colArrayCount++;
								}
							}
							if(dataCount < designCnt)
							{
		%>
														</table>
													</div>
												</div>
											</td>
											<td width="50%" valign="top" style="border:0px;padding:0px">
												<div style="margin:10px 0px 10px 0px;" class="newPlainTable">
													<div class="font_bold12">Client Start up (secs)</div>
													<div>
														<table style="border:0px">
		<%
							}else
							{
								int tempCount1 = colArrayCount%4;
								if(tempCount1 != 0)
								{
									tempCount1 = 4 - tempCount1;
								}
								for(int cnts=0;cnts<tempCount1;cnts++)
								{
		%>
									<td></td>
									<td></td>
		<%
								}
		%>
								</tr>
								<tr>
									<td class="newFont_bold12" style="text-align:left;background-color:#f9f9f9" colspan="8"> Client Start up (secs) </td>
								</tr>
								<tr>
		<%
								colArrayCount = 0;
							}
							arr1=(JSONArray)obj2.get("Client");
							for(int z=0;z<arr1.size();z++)
							{
								obj3=(JSONObject)arr1.get(z);
								String key = (String)obj3.get("key"); 
								key = "<span class=font_bold12>"+key+"</span>";
								String value = (String)obj3.get("value"); 
								if(z > 0 && colArrayCount%4==0 && dataCount >= designCnt)
								{
		%>
									</tr>
									<tr>
		<%
								}
								if(dataCount < designCnt)
								{
		%>
									<tr style="background:none"><td style="border:0px;padding:4px 0px 2px 0px"><%=key%></td><td style="border:0px;padding:4px 0px 2px 0px"><%=value%></td></tr>
		<%
								}else
								{
		%>
									<td style="background-color:#e6e6e6;"><%=key%></td>
									<td><%=value%></td>
		<%
									colArrayCount++;
								}
							}
							if(dataCount < designCnt)
							{
		%>
														</table>
													</div>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</td>
						</tr>
		<%
						}
						}
						if(obj1 != null && obj1.containsKey("additionalDatasforVDI"))
						{
							obj2=(JSONObject)obj1.get("additionalDatasforVDI");
							arr1=(JSONArray)obj2.get("logonBreakup");
							if(dataCount < designCnt)
							{
		%>
						<tr style="background-color:<%=rowcolr%>">
							<td colspan="<%=colArray.size()%>" >
								<div>
									<table width="100%" style="border:0px">
										<tr style="background:none">
											<td width="50%" valign="top" style="border:0px;padding:0px">
												<div style="margin:10px 10px 10px 0px;" class="newPlainTable">
													<div class="font_bold12">logon Time Break-up (secs)</div>
													<div style="height:155px;overflow:auto;">
														<table style="border:0px">
		<%
							}else
							{
								int tempCount = colArrayCount%4;
								if(tempCount != 0)
								{
									tempCount = 4 - tempCount;
								}
								for(int cnts=0;cnts<tempCount;cnts++)
								{
		%>
									<td></td>
									<td></td>
		<%
								}
		%>
								</tr>
								<tr>
									<td class="newFont_bold12" style="text-align:left;background-color:#f9f9f9" colspan="8"> logon Time Break-up (secs) </td>
								</tr>
								<tr>
			<%
								colArrayCount = 0;
							}
							for(int z=0;z<arr1.size();z++){
								obj3=(JSONObject)arr1.get(z);
								String key = (String)obj3.get("key"); 
								key = "<span class=font_bold12>"+key+"</span>";
								String value = (String)obj3.get("value");
								if(z > 0 && colArrayCount % 4 == 0 && dataCount >= designCnt)
								{
		%>
									</tr>
									<tr>
		<%
								}
								if(dataCount < designCnt)
								{
		%>
										<tr style="background:none"><td style="border:0px"><%=(String)obj3.get("key")%></td><td style="border:0px"><%=(String)obj3.get("value")%></td></tr>
		<%
								}else
								{
		%>
									<td style="background-color:#e6e6e6"><%=key%></td>
									<td><%=value%></td>
		<%
									colArrayCount++;
								}
							}
							if(dataCount < designCnt)
							{
		%>
														</table>
													</div>
												</div>
											</td>
											<td width="50%" valign="top" style="border:0px;padding:0px">
												<div style="margin:10px 0px 10px 0px;" class="newPlainTable">
													<div class="font_bold12">Group policy Time Break-up (secs)</div>
													<div style="height:155px;overflow:auto;">
														<table style="border:0px">
		<%
							}
							else
							{
								int tempCount1 = colArrayCount%4;
								if(tempCount1 != 0)
								{
									tempCount1 = 4 - tempCount1;
								}
								for(int cnts=0;cnts<tempCount1;cnts++)
								{
		%>
									<td></td>
									<td></td>
		<%
								}
		%>
								</tr>
								<tr>
									<td class="newFont_bold12" style="text-align:left;background-color:#f9f9f9" colspan="8"> Group policy Time Break-up (secs) </td>
								</tr>
								<tr>
		<%
								colArrayCount = 0;
							}
							arr1=(JSONArray)obj2.get("gpBreakup");
							for(int z=0;z<arr1.size();z++){
								obj3=(JSONObject)arr1.get(z);
								String key = (String)obj3.get("key"); 
								key = "<span class=font_bold12>"+key+"</span>";
								String value = (String)obj3.get("value"); 
								if(z > 0 && colArrayCount%4==0 && dataCount >= designCnt)
								{
		%>
									</tr>
									<tr>
		<%
								}
								if(dataCount < designCnt)
								{
		%>
									<tr style="background:none"><td style="border:0px"><%=key%></td><td style="border:0px"><%=value%></td></tr>
		<%
								}
								else
								{
		%>
									<td style="background-color:#e6e6e6"><%=key%></td>
									<td><%=value%></td>
		<%
								}
								colArrayCount++;
							}
							if(dataCount < designCnt)
							{
		%>
														</table>
													</div>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</td>
						</tr>
		<%
						}
						}
						if(obj1 != null && obj1.containsKey("GPDetails"))
						{
							isGpDetials =true;
							obj2=(JSONObject)obj1.get("GPDetails");
							JSONArray gphdr=(JSONArray)obj2.get("Header");
							JSONArray gridGpDatas=(JSONArray)obj2.get("Datas");
							if(dataCount < designCnt)
							{
		%>
						<tr style="background-color:<%=rowcolr%>;" >
							<td colspan="<%=colArray.size()%>" style="border-bottom:0px">
								<div class="font_bold12"><egui:intnl text="reporter.common.Details of client side extensions"/></div>
								<div class="newTable" style="padding: 5px 0px 10px 0px;">
									<table width="100%" style="border:1px solid #cdcdcd;border-bottom:0px">
										<thead>
											<tr>
		<%
						for(int i=0;i<gphdr.size();i++){
							String hdrStr=(String)gphdr.get(i);
		%>
									<th><%=hdrStr%></th>
		<%
						}
		%>
											</tr>
										</thead>
										<tbody>
		<%
						for(int i=0;i<gridGpDatas.size();i++){
							JSONObject hdrObj=(JSONObject)gridGpDatas.get(i);
		%>
					<tr>
		<%
							for(int j=0;j<gphdr.size();j++){
								String hdrStr=(String)gphdr.get(j);
		%>
							<td><%=(String)hdrObj.get(hdrStr)%></td>
		<%
							}
		%>

					</tr>
		<%
						}
		%>

										</tbody>
									</table>
								</div>
							</td>
						</tr>
		
		<%
							}else
							{
								int tempCount = colArrayCount%4;
								if(tempCount != 0)
								{
									tempCount = 4 - tempCount;
								}
								for(int cnts=0;cnts<tempCount;cnts++)
								{
		%>
									<td></td>
									<td></td>
		<%
								}
		%>
								</tr>
								<tr>
									<td class="newFont_bold12" style="text-align:left" colspan="8"> Details of client side extensions </td>
								</tr>
								<tr>
		<%
								for(int i=0;i<gridGpDatas.size();i++)
								{
									JSONObject hdrObj=(JSONObject)gridGpDatas.get(i);
									colArrayCount = 0;
									for(int j=0;j<gphdr.size();j++)
									{
										String hdrStr = (String)gphdr.get(j);
										String tempHdrStr = "<span class=font_bold12>"+hdrStr+"</span>";
										boolean isClosed = false;
										if(colArrayCount%4==0)
										{
											isClosed = true;
		%>
											</tr>
											<tr>
		<%
										}
		%>
										<td style="background-color:#e6e6e6"><%=tempHdrStr%></td>
										<td><%=(String)hdrObj.get(hdrStr)%></td>
		<%
										colArrayCount++;
									}
									int tempCountArr = colArrayCount%4;
									if(tempCountArr != 0)
									{
										tempCountArr = 4 - tempCountArr;
									}
									for(int cnts=0;cnts<tempCountArr;cnts++)
									{
		%>
										<td></td>
										<td></td>
		<%
									} 
								}
							}
						}
						if(dataCount >= designCnt && !isGpDetials)
						{
							int emptyCount = colArrayCount%4;
							if(emptyCount!=0)
							{
								emptyCount = 4-emptyCount;
								for(int count=0;count<emptyCount;count++)
								{
			%>
									<td></td>
									<td></td>
			<%
								}
							}
			%>
							</tr>
			<%
						}
%>
					</tbody>
				</table>
<%
					}
					if(dataCount < designCnt)
					{
		%>
					
			</div>
		<%
					}
				}



			}
		}
%>
</div>

<%
		}
		else if(s_comptype!=null && (s_comptype.equalsIgnoreCase("Citrix_XcXenDesktop_Director") ||s_comptype.equalsIgnoreCase("Citrix_XcXenDesktop_Site")||s_comptype.equalsIgnoreCase("Citrix_Cloud_Site")))
		{
			List dirHeader = new ArrayList();
			List mainGrid = new ArrayList();
			headerObject = new ArrayList();
			int headCount=0;
			List alHeader = new ArrayList();
			String sessionQryString=(String) session.getAttribute("USER_LOGON_Query_String");
			if(sessionQryString!=null)
				queryString=sessionQryString;
			if(queryString!=null)
			{
				StringTokenizer strtok = new StringTokenizer(queryString,"&");
				while(strtok.hasMoreTokens())
				{
					String param = strtok.nextToken();
					int ind = param.indexOf("=");
					if (ind < 0 || param.indexOf("responseType")>-1)
						continue;
					String reqparam =param.substring(0,ind);
					String value = param.substring(ind+1);
					if(reqparam.equals("startdate") || reqparam.equals("enddate") || reqparam.equals("inidate")|| reqparam.equals("pdfTime")|| reqparam.equals("select_testmes")|| reqparam.equals("uid"))
					{
						// Because of double time encode
						value=com.eg.EgURLDecoder.decode(value,"UTF-8");
					}
					value=com.eg.EgURLEncoder.encode(value, "UTF-8");
					if (rtype != null && rtype.equalsIgnoreCase("No"))
					{
						if(reqparam.equalsIgnoreCase("opt"))
							value="Graph";
					}
					if (rtype != null && rtype.equalsIgnoreCase("No"))
					{
						if(!reqparam.equalsIgnoreCase("er_view"))
							Qstring=Qstring+reqparam+"="+value+"&";
					}
				}
			}
			String dirHeading = "";
			String dirTestName="CtxXcXAEuemTest";
			String testName ="";
			String test ="";
			boolean isSummary=false;
			if(er_aggregateValue==null || er_aggregateValue.equalsIgnoreCase("Details"))
			{
				isSummary=false;
				er_aggregateValue="Details";
			}
			else
			{
				isSummary=true;
			}
			String testKey=er_aggregateValue;
			if (resultMap != null && resultMap.containsKey("USER_LOGON_TEST_NAME"))
			{
				test=(String)resultMap.get("USER_LOGON_TEST_NAME");
			}
			if (resultMap != null && resultMap.containsKey("USER_LOGON_KEY"))
			{
				testKey=(String)resultMap.get("USER_LOGON_KEY");
			}
			if(er_aggregateValue!=null && er_aggregateValue.equals("Summary"))
			{
				dirHeading = reportInfo.getValue("USER_LOGON_REPORT","Summary_Dir:"+dirTestName);
			}
			else if(er_aggregateValue!=null && er_aggregateValue.equals("Details"))
			{
				dirHeading = reportInfo.getValue("USER_LOGON_REPORT","Details_Dir:"+dirTestName);
				dirHeading = "trgt_host,"+dirHeading;
			}
			StringTokenizer strs = new StringTokenizer(dirHeading,",");
			while(strs.hasMoreTokens())
			{
				String separateHead = strs.nextToken();
				alHeader.add(separateHead);
				separateHead = intlmap.getMeasureDescription(dirTestName,separateHead);
				if(separateHead.equalsIgnoreCase("trgt host"))
				{
					separateHead = "XenApp Server";
				}
				dirHeader.add(separateHead);
			}
			String measureStr = reportInfo.getValue("USER_LOGON_REPORT",testKey+":"+test);
			StringTokenizer st = new StringTokenizer(measureStr,",");
			String queryStringForData= "/final/servlet/com.eg.ErCitrixSessionLogonServletC;jsessionid=" + session.getId() + "?isChartRequest=true&chartFor=Topgraph&"+Qstring;
			JSONObject legendObj=(JSONObject)session.getAttribute("USER_LOGON_DATA_CHARTLEGEND");
%>
<table align="center" cellspacing="0" cellpadding="0" width="100%" class="newimg">
	<tr>
		<td width="50%" style="padding:5px 5px 0px 0px;">
			<div class="printOuterBox">
			<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.Logon Duration Trend" /></div>
			<table align="center" cellspacing="0" cellpadding="0" width="100%">
				
				<tr>
					<td>
						<div align="center"><img src="<%=queryStringForData %>&er_width=430&er_height=250&optt=graph&er_view=IMAGE&isTimeReport=true" border="0" hspace="0" vspace="0" ></img></div>
					</td>
				</tr>
			</table>
			</div>
		</td>









		 <td  style="valign:top;padding:5px 0px 0px 5px;" valign="top" width="50%">
			<div class="printOuterBox">
			<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.Avg Logon Duration Breakdown" /></div>
		<%
			strUrl="../../final/servlet/com.eg.ErCitrixSessionLogonServletC;jsessionid="+session.getId()+"?isGraphReq=true&chartType=donut&chartReqFor=logonStartupBreakdown&imagereq=yes&er_width=250&er_height=250";
		%>		
				<table width="100%">
					<tr>
						<td width="60%">
							<div style="float:right;"><img src="<%=strUrl%>" /></div>
						</td>
						<td width="40%" valign="middle">
							<table>
			<%
							detailsObj=(JSONObject)graphDatas.get("logonStartupBreakdown");
							if(detailsObj!=null)
							{
								JSONArray legArr1=(JSONArray)detailsObj.get("legendArray");
								JSONObject obj=null;
								for(int k=0;k<legArr1.size();k++){
									obj=(JSONObject)legArr1.get(k);
			%>
								<tr><td style="padding-right: 5px;" ><div style="height:7px;width:7px;-webkit-border-radius:4px;background-color:<%=(String)obj.get("color")%>"></div></td><td><%=(String)obj.get("name")%>&nbsp;(<%=(Double)obj.get("val")%>)</td></tr>
			<%
									if(obj != null && obj.size() > 0 && obj.containsKey("innerArray")){
										JSONArray tmplegArray=(JSONArray)obj.get("innerArray");
										if(tmplegArray != null && tmplegArray.size() > 0){
											JSONObject tmpobj2=null;
											for(int m=0;m<tmplegArray.size();m++){
											tmpobj2=(JSONObject)tmplegArray.get(m);
											if(tmpobj2 != null && tmpobj2.size() > 0){
			%>
											
											<tr><td>&nbsp;</td><td>&nbsp;&nbsp;<%=(String)tmpobj2.get("name")%>&nbsp;(<%=(Double)tmpobj2.get("val")%>)</td></tr>
			<%
											}
											}
										}
									}
								}
							}
			%>
							</table>
						</td>
					</tr>
				</table>
			</div>
		</td>
	</tr>
</table>
<%
			if (resultMap != null && resultMap.containsKey("USER_LOGON_DATA_NEW") && needLogonDetailsTable){
				JSONArray valuesArr = (JSONArray)resultMap.get("USER_LOGON_DATA_NEW");
				if(valuesArr != null && valuesArr.size() > 0){
					JSONObject dirData=null;
					JSONObject gbSplitup=null;
					JSONObject dirDataFrmVmg=null;
					JSONObject gbSplitupFrmVmg=null;
					if(enableDetailedDataCHECK != null && enableDetailedDataCHECK.equalsIgnoreCase("Yes") && er_aggregateValue  != null && er_aggregateValue.equalsIgnoreCase("Details")){
						if(resultMap.containsKey("Slow_Logon_Dir_Data")){//for slow logon Details grid 
							dirData=(JSONObject)resultMap.get("Slow_Logon_Dir_Data");
						}
						if(resultMap.containsKey("slowlogonGPDurationSplitup")){
							gbSplitup=(JSONObject)resultMap.get("slowlogonGPDurationSplitup");
						}
						if(resultMap.containsKey("Slow_Logon_Dir_DataForVMG")){//for slow logon Details grid (From VMG Test)
							dirDataFrmVmg=(JSONObject)resultMap.get("Slow_Logon_Dir_DataForVMG");
						}
						if(resultMap.containsKey("slowlogonGPDurationSplitupForVMG")){//for slow logon Details grid (From VMG Test)
							gbSplitupFrmVmg=(JSONObject)resultMap.get("slowlogonGPDurationSplitupForVMG");
						}
					}
					detailsObj=userBean.getSlowLogonGridDetailedDatas(valuesArr,dirData,gbSplitup,dirDataFrmVmg,gbSplitupFrmVmg,er_componentType,intlmap,currentDateFormat,isSummary,enableAggregation,threshObj,er_aggregateValue,lst);
					if(detailsObj != null && detailsObj.size() > 0){
					JSONArray colArray=(JSONArray)detailsObj.get("columns");
					JSONArray datArray=(JSONArray)detailsObj.get("dataArray");
					JSONObject griddatasObj=null;
					JSONObject startupData=null;
					if(colArray!=null && colArray.size()>11)
					{
%>
					<pd4ml:page.break htmlWidth="1750">
<%
					}

		%>
			<div class="printOuterBox newTableDiv" style="padding:10px 10px 0px 0px;overflow:unset;">
				<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.User Logon Analysis "/>&nbsp;(<egui:intnl text="reporter.common.secs"/>)&nbsp;</div>
				<table width="100%" class="firstTable">
					<thead>
						<tr>
		<%
				for(int i=0;i<colArray.size();i++){
					String colName=(String)colArray.get(i);
		%>
					<th><%=colName%></th>
		<%
				}
		%>
						</tr>
					</thead>
					<tbody>
		<%
				for(int i=0;i<datArray.size();i++){
					JSONObject dataObj=(JSONObject)datArray.get(i);
					JSONObject detailedData=null;
					if(dataObj != null && dataObj.containsKey("dirtData")){
						detailedData=(JSONObject)dataObj.get("dirtData");
					}
		%>
				<tr>
		<%
					for(int j=0;j<colArray.size();j++){
						String colName=(String)colArray.get(j);
						String dataVal=(String)dataObj.get(colName);
						if(colName != null && (colName.equalsIgnoreCase("Session start-up duration") || colName.equalsIgnoreCase("LOGON DURATION"))){
							if(dataVal != null && dataVal.indexOf("$$") > -1){
								String tmp=dataVal.substring(dataVal.indexOf("$$")+2);
								dataVal=dataVal.substring(0,dataVal.indexOf("$$"));
								String divClassName="";
								if(tmp != null && tmp.equalsIgnoreCase("critical"))
									divClassName = "reporterUserLogonHigh";
								else if(tmp != null && tmp.equalsIgnoreCase("major"))
									divClassName = "reporterUserLogonMedium";
								else if(tmp != null && tmp.equalsIgnoreCase("minor"))
									divClassName =  "reporterUserLogonLow";
								else if(tmp != null && tmp.equalsIgnoreCase("normal"))
									divClassName = "reporterUserLogonNormal";
								else
									divClassName="reporterUserLogonDefault";
								dataVal="<div class='"+divClassName+"' width='60%' align='center'>"+dataVal+"</div>";
							}
						}
						if(colName != null && (colName.equalsIgnoreCase("USER NAME") || colName.equalsIgnoreCase("SERVER") || colName.equalsIgnoreCase("SESSION STARTUP TIME") || colName.equalsIgnoreCase("CLIENT IP ADDRESS") || colName.equalsIgnoreCase("CLIENT NAME") || colName.equalsIgnoreCase("CLIENT VERSION") || colName.equalsIgnoreCase("CONTROLLER NAME") || colName.equalsIgnoreCase("LAUNCHED VIA IP ADDRESS") )){
		%>
				<td><%=dataVal%></td>
		<%
						}else{
		%>
				<td align="center"><%=dataVal%></td>
		<%
						}
					}
		%>
				</tr>
		<%		if(detailedData != null ){
		%>
				<tr>
					<td colspan="<%=colArray.size()%>"> 
						<div class="userLogonInnerTableOuter" style="margin:10px">
		<%
		

					if(detailedData != null && detailedData.containsKey("clinetServerData")){
						startupData=(JSONObject)detailedData.get("clinetServerData");
						String tit=(String)startupData.get("title");
						JSONObject mainHeader=(JSONObject)startupData.get("mainHeader");
						JSONObject serverHeader=(JSONObject)startupData.get("serverHeader");
						JSONObject clientHeader=(JSONObject)startupData.get("clientHeader");
						JSONArray commnData=(JSONArray)startupData.get("commnData");
						JSONArray serverData=(JSONArray)startupData.get("serverData");
						JSONArray clientData=(JSONArray)startupData.get("clientData");

		%>

   <table cellpadding="0" cellspacing="0" border="0px" class="newimg">
      <tbody>
         <tr>
            <td style="padding:20px">
               <div class="reporterHtmlFieldsetBody">
                  <div class="reporterLogonFieldsetHeader" nowrap=""><%=tit%></div>
                  <table width="100%" cellpadding="0" cellspacing="0" border="0px" style="border:0px">
                     <tbody>

                        <tr>
                           <td colspan="3" style="padding:6px;height:30px" align="center">
                              <div class="reporterLogonSessionStartupBox" style="width:350px;height:24px;margin:20px auto 10px  auto;">
                                 <table border="0" style="margin:3px auto;">
                                    <tbody>
                                       <tr>
                                          <td class="reporterLogonSessionStartup">Session Start-up Duration (secs) :</td>
                                          <td class="reporterLogonSessionStartupValue"><%=(String)mainHeader.get("value")%></td>
                                       </tr>
                                    </tbody>
                                 </table>
                              </div>
                           </td>
                        </tr>

						<tr>
						    <td style="padding:0px 5px 20px 20px" valign="top">
                              <table border="0px" style="width:100%" class="reporterLogonServerStartUpTable">
                                 <tbody>
                                    <tr>


									<td valign="middle" rowspan="2" class="rowspanRightBorder">
                                          <table border="0px" style="width:150px;float:left;margin-top:7px">
                                             <tbody>
							<%
								for(int l=0;l<commnData.size();l++){
									griddatasObj=(JSONObject)commnData.get(l);
							%>
												<tr>
                                                   <td>
                                                      <div class="reporterLoginSessionLabel" style="text-align:center;"><%=(String)griddatasObj.get("key")%></div>
                                                      <div class="reporterLoginPopupVal" style="text-align:center;"><%=(String)griddatasObj.get("value")%></div>
                                                   </td>
                                                </tr>
							<%
								}
							%>


											  </tbody>
                                          </table>
                                       </td>



									   <td valign="top">
                                          <table border="0px" style="width:100%;float:left">
                                             <tbody>
                                                <tr>
                                                   <td class="reporterLogonPanelHead" style="width:90%"><%=(String)serverHeader.get("key")%>&nbsp;(<egui:intnl text="reporter.common.secs"/>)&nbsp;</td>
                                                   <td style="align:right;" class="reporterLogonPanelHead">
                                                      <div style="float:right;width:60px;text-align:left;"><%=(String)serverHeader.get("value")%></div>
                                                   </td>
                                                </tr>
                                             </tbody>
                                          </table>
                                       </td>
                                    </tr>
									
									<tr>
										<!-- <td valign="top">
                                          <table border="0px" style="width:150px;float:left;margin-top:7px">
                                             <tbody>
							<%
								for(int l=0;l<commnData.size();l++){
									griddatasObj=(JSONObject)commnData.get(l);
							%>
												<tr>
                                                   <td>
                                                      <div class="reporterLoginSessionLabel" style="text-align:center;"><%=(String)griddatasObj.get("key")%></div>
                                                      <div class="reporterLoginPopupVal" style="text-align:center;"><%=(String)griddatasObj.get("value")%></div>
                                                   </td>
                                                </tr>
							<%
								}
							%>


											  </tbody>
                                          </table>
                                       </td> -->
									   <td valign="top">
                                          <div style="height:150px;overflow:auto;width:100%">
                                             <table border="0px" style="float:left;" class="reporterLogonPanelBody">
                                                <tbody>
							<%
								for(int l=0;l<serverData.size();l++){
									griddatasObj=(JSONObject)serverData.get(l);
							%>


												  <tr>
                                                      <td style="width:90%"><%=(String)griddatasObj.get("key")%></td>
                                                      <td style="align:right;">
                                                         <div class="valueDiv"><%=(String)griddatasObj.get("value")%></div>
                                                      </td>
                                                   </tr>

							<%
								}
							%>

												 </tbody>
                                             </table>
                                          </div>
                                       </td>
									</tr>
								</tbody>
                              </table>
                           </td>
						   <!-- <td style="padding:0px 10px 0px 10px" valign="top">
                              <div class="reporterLogonDivider"></div>
                           </td> -->

                           <td style="padding:0px 20px 20px 5px">
                              <table border="0" style="width:100%;float:left" class="reporterLogonServerStartUpTable">
                                 <tbody>
									

								    <tr>
                                       <td>
                                          <table width="100%">
                                             <tbody>
                                                <tr>
                                                   <td class="reporterLogonPanelHead" style="text-align:left;width:90%"><%=(String)clientHeader.get("key")%>&nbsp;(<egui:intnl text="reporter.common.secs"/>)&nbsp;</td>
                                                   <td style="align:right;" class="reporterLogonPanelHead">
                                                      <div style="float:right;width:60px;text-align:left;"><%=(String)clientHeader.get("value")%></div>
                                                   </td>
                                                </tr>
                                             </tbody>
                                          </table>
                                       </td>
                                    </tr>

									<tr>
                                    	<td>
                                        	<div style="height:150px;overflow:auto;width:100%">
                                            	<table class="reporterLogonPanelBody" width="100%">
                                            	<tbody>

							<%
								for(int l=0;l<clientData.size();l++){
									griddatasObj=(JSONObject)clientData.get(l);
							%>
                                                   <tr>
													<td style="width:80%"><%=(String)griddatasObj.get("key")%></td>
                                                      <td style="align:right;">
                                                         <div class="valueDiv"><%=(String)griddatasObj.get("value")%></div>
                                                      </td>
                                                   </tr>
							<%
								}
							%>
												</tbody>
                                             </table>
                                          </div>
                                       </td>
                                    </tr>
				 </tbody>
                              </table>
                           </td>
			</tr>
		     </tbody>
                  </table>
               </div>
            </td>
         </tr>
      </tbody>
   </table>

  
		<%
					}
					if(detailedData != null && detailedData.containsKey("gpDatas") ){
						startupData=(JSONObject)detailedData.get("gpDatas");
						JSONArray gpHeader=(JSONArray)startupData.get("gpHeader");
						JSONArray gpDataArr=(JSONArray)startupData.get("gpDataArr");

		%>

							<div class="userLogonInnerTableOuter bg2" style="position:relative;margin:10px 20px 10px 0px">
				<div class="reportLogonGridColumnHighlightArrow" style="left:100px;top:-10px"></div>
				<p class="font_bold12"><egui:intnl text="reporter.common.Details of client side extensions"/></p>
				<div class="newTable">
					<table width="100%">
						<thead>
							<tr>
		<%
						for(int k=0;k<gpHeader.size();k++){
							String headr=(String)gpHeader.get(k);
		%>
								<th><%=headr%></th>
		<%
						}
		%>
							</tr>
						</thead>
						<tbody>
		<%
						for(int j=0;j<gpDataArr.size();j++){
							griddatasObj=(JSONObject)gpDataArr.get(j);
		%>
							<tr>
		<%
							for(int k=0;k<gpHeader.size();k++){
								String headr=(String)gpHeader.get(k);
		%>
								<td><%=(String)griddatasObj.get(headr)%></td>
		<%
							}
		%>
							</tr>
		<%
						}
		%>

						</tbody>
					</table>
				</div>
			</div>
		<%
					}
		%>
				</div>
			</td>
		</tr>
		<%
		}
				}
		%>
		
					</tbody>
				</table>
			</div>
		
		<%
				}
				}
			}
		}
		else
		{
%>
			<table align="center" width="97%" cellspacing="0" cellpadding="4"   border="0">
				<tr>
					<table width='100%' height='100%'><tr>	<td align='center' valign='middle'><img src='/images/Light/nomeasures_custom.png' /></td></tr></table>
				</tr>
			</table>	
<%
		}
	}
%>
</table>
</div>
</body>
</html>
<%
	
	Hashtable sen1 = new Hashtable();
	if(lst_dat1!=null && !lst_dat1.isEmpty())
	{
		if(er_option!=null && !er_option.equalsIgnoreCase("component"))
			lst.add("User Logon Details for "+er_option+" : "+request.getParameter("select_farm")+ " - "+s_comptype);

		String s_tit1= "User Logon Analysis ";
		if(s_comptype!=null)
			s_tit1+="for "+intlmap.getComponentTypeDescription(s_comptype);
		
		sen1.put(vec1,lst_dat1);		
				
		Hashtable ht1=new Hashtable();
		ht1.put(s_tit1,sen1);
		lst.add(ht1);
				
		sen1 = new Hashtable();
		ht1 = new Hashtable();
		session.setAttribute("ScheduleCSVData",lst);
	}
	else
		session.setAttribute("ScheduleCSVData",lst);

	if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
	{
		%>
			<div class="printFooterText"><%=strPrintFooterText%></div>
		<%
	}
}
catch(Exception e)
{
	e.printStackTrace();
}
%>
<%@ 
	include file = "ErRemoveUser.jsp" %>
<%
			if(titleToDisplay!=null && !titleToDisplay.isEmpty())
	{
	//For Setting the PDf File Name
	String reportFileName=customReplaceAll(titleToDisplay," ","_");
	HashMap paramVal =new HashMap();
	paramVal.put("fileName",reportFileName);
	session.setAttribute("parameters", paramVal);
	}

%>
<%!
	// karthikeyan 
    public  String customReplaceAll(String source,String toReplace,String replacement) {
        int idx = source.lastIndexOf(toReplace);
        if (idx != -1) {
            StringBuffer ret = new StringBuffer(source);
            ret.replace(idx, idx + toReplace.length(), replacement);
			while ((idx = source.lastIndexOf(toReplace, idx - 1)) != -1)
			{
                ret.replace(idx, idx + toReplace.length(), replacement);
            }
            source = ret.toString();
        }
        return source;
	}




public  boolean isArraycontains(String [] array,String val){
	if(array!=null){
	   for(int i=0;i<array.length;i++){
			if(val.equalsIgnoreCase(array[i])){
				return true;
			}
		}
	}
		return false;
}



	
%>
