<%@ include file = "EgLoginTracker.jsp" %>
<%@ page import = "java.util.*" %>
<%@ page import = "java.net.*" %>
<%@ page import = "java.sql.*" %>
<%@ page import = "com.eg.EgInstallInfo" %>
<%@ page import = "com.eg.IniFile" %>
<%@ page import ="com.egurkha.util.StringUtils"%>
<%@ page import = "egurkha.reporter.ErUtils"%>
<%@ page import = "egurkha.reporter.ErUserData"%>
<%@ page import = "com.egurkha.ini.IniUI"%>
<%@ page import = "com.eg.*"%>
<%@ page import = "com.egurkha.*"%>
<%@ page import = "com.egurkha.monitor.*"%>
<%@ page import = "com.egurkha.monitor.VmDashboardHelper"%>
<%@ page import = "com.egurkha.monitor.ServicesDashboardBean"%>
<%@ page import = "com.egurkha.monitor.MonitorUtilities"%>
<%@ page import = "com.egurkha.monitor.MonitorUtility"%>
<%@ page import = "com.eg.EgAggregateInfo"%>
<%@ page import="com.eg.EgExternalInfo"%>
<%@ page import = "com.eg.EgDateInfo" %>
<%@ page import = "com.eg.EgTopoInfo" %>
<%@ page import = "com.eg.*" %>
<%@ page import = "egurkha.*" %>
<%@ page import = "com.egurkha.*" %>
<%@ page import = "com.egurkha.util.*" %>
<%@ page import = "com.egurkha.EgTimeZoneConverter"%>
<%@ page import = "java.util.TimeZone"%>
<%@ page import = "java.util.Calendar"%>
<%@ page import = "com.egurkha.util.DateUtil"%>
<%@ page import="net.sf.json.*"%>
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="egui" uri="../WEB-INF/eg-taglib.tld" %>

<%!
	ServicesDashboardBean serviceBean = new ServicesDashboardBean();
	String s_iniFile_dir = EgInstallInfo.getInstallDir()+ "/manager/config/";


	public HashMap getServiceBasedFilter(String appliesTo)
	{
		String filterFlagT = "";
		String filterByParamFlagT = "";		
		String hasMSOffice = "false";
		String hasMSMail = "false";
		String hasMSSharePoint = "false";

		String comp_type = "";
		List msdashboard_arr = new ArrayList();
		EgTopoInfo topoInfo = new EgTopoInfo("manager");

		HashMap returnParams = new HashMap();

		if(appliesTo!=null && appliesTo.trim().length()>0)
		{
			if(filterFlagT=="" || filterFlagT.trim().length()==0)
				filterFlagT= appliesTo.substring(0,appliesTo.indexOf(":"));

			if(filterByParamFlagT=="" || filterByParamFlagT.trim().length()==0)
				filterByParamFlagT = appliesTo.substring(appliesTo.indexOf(":")+1);

			if(filterFlagT != null && filterFlagT.trim().length() > 0 && filterFlagT.equalsIgnoreCase("Service")){
				if(filterByParamFlagT != null && filterByParamFlagT.trim().length() > 0)
				{	
					Vector compVec = topoInfo.getAssociatesForSite(filterByParamFlagT);
					for(int k=0; k<compVec.size(); k++)
					{
						String comp =(String) compVec.get(k);

						if(comp.indexOf("MS_Office_365") > -1){
							hasMSOffice = "true";
							comp_type = comp.substring(comp.indexOf(":")+1);
							msdashboard_arr.add(comp_type);
						}
						else if(comp.indexOf("MSExchangeOnline") > -1){
							hasMSMail = "true";
							comp_type = comp.substring(comp.indexOf(":")+1);
							msdashboard_arr.add(comp_type);
						}
						else if(comp.indexOf("MSExchangeOnline") > -1){
							hasMSSharePoint = "true";
							comp_type = comp.substring(comp.indexOf(":")+1);
							msdashboard_arr.add(comp_type);						
						}
					}					
				}
			}
		}		
		returnParams.put("hasMSOffice",hasMSOffice);
		returnParams.put("hasMSMail",hasMSMail);
		returnParams.put("hasMSSharePoint",hasMSSharePoint);	
		returnParams.put("comp_type",comp_type);
		returnParams.put("msdashboard_arr",msdashboard_arr);

		return returnParams;
	}
	
	public String UrlParamReplace(String orgUrl,String replaceKey,String replaceValue)
    {
        String url = null;
        if(orgUrl!=null && orgUrl.indexOf(replaceKey)>0)
        {
            String params = orgUrl.substring(orgUrl.indexOf("?")+1);
            url = orgUrl.substring(0,orgUrl.indexOf("?"))+"?";
            String param[]=params.split("&");
            if(param != null && param.length>0)
            {
                for(int a = 0;a<param.length;a++)
                {
                    if(param[a].startsWith(replaceKey))
                    {
                        param[a] = replaceKey+"="+replaceValue;
                    }
                    if(a<param.length-1)
                        url = url + param[a]+"&";
                    else
                        url = url + param[a];
                }
            }
        }
        else
        {
            url = orgUrl + "&" +replaceKey+"="+replaceValue;
        }
       return url;
    }
%>

<%
	String setSession = request.getParameter("setSession");
	String active_view = request.getParameter("active_view");
	String dashboard_name = request.getParameter("dashboard_name");
	String dashboardCompType = request.getParameter("compType");

	if(setSession != null && setSession.equalsIgnoreCase("true"))
	{
		String qryString = (String)session.getAttribute("monitorLastSession");
		qryString = UrlParamReplace(qryString,"active_view",active_view);
		qryString = UrlParamReplace(qryString,"dashboard_name",dashboard_name);

		if(dashboardCompType != null)
			qryString = UrlParamReplace(qryString,"compType",dashboardCompType);

		session.setAttribute("monitorLastSession",qryString);
		return;
	}
	EgDateInfo egDt = new EgDateInfo();
	java.util.Date local_date = new java.util.Date(egDt.egetUTCDate());
	Calendar cal = Calendar.getInstance();
	cal.setTime(local_date);
	cal.setTimeZone(egDt.getRealTimeZone());

	String iniName = request.getParameter("iniName");
	String userBased = request.getParameter("userBased");
	
	String showConfig = request.getParameter("showConfig");
	String appliesTo = request.getParameter("appliesTo");
	String isFromZone = request.getParameter("isFromZone");
	String iszoneName = request.getParameter("iszoneName");
	String parentZone = request.getParameter("parentZone");	
	String selectedState=request.getParameter("selectedState");
	selectedState = (selectedState==null||selectedState.trim().length()==0||selectedState.equalsIgnoreCase("null")||selectedState.equalsIgnoreCase("undefined"))?"":selectedState;	

	String activeView=null;
	activeView = request.getParameter("active_view");
	
	boolean isFromMenu = false;
	String fromMenu = request.getParameter("fromMenu");
	if(fromMenu != null && fromMenu.trim().length() > 0 && (fromMenu.equalsIgnoreCase("true") || fromMenu.equalsIgnoreCase("yes")))
		isFromMenu = true;
	
	String fromList = request.getParameter("from");
	boolean isFromList = false;	
	if(fromList != null && fromList.trim().length() > 0 && fromList.equalsIgnoreCase("list"))
		isFromList = true;
	boolean isFromMetrics = false;	
	if(fromList != null && fromList.trim().length() > 0 && fromList.equalsIgnoreCase("metricsView"))
		isFromMetrics = true;

	boolean isFromHomepage = false;
	String fromHomepage =request.getParameter("fromHomepage");
	if(fromHomepage != null && fromHomepage.trim().length() > 0 && (fromHomepage.equalsIgnoreCase("true") || fromHomepage.equalsIgnoreCase("yes")))
		isFromHomepage = true;

	String fromPageView =request.getParameter("fromPageView");
	if(fromPageView != null && fromPageView.trim().length() > 0 && fromPageView.equalsIgnoreCase("Home"))
		isFromHomepage = true;

	boolean isFromServiceMenu = false;
	String fromServiceMenu=request.getParameter("isFromServiceMenu");
	if(fromServiceMenu != null && fromServiceMenu.trim().length() > 0 && (fromServiceMenu.equalsIgnoreCase("true") || fromServiceMenu.equalsIgnoreCase("yes")))
		isFromServiceMenu = true;
		
	boolean isFromZoneMain = false;
	String fromZoneMain=request.getParameter("isFromZoneMain");
	if(fromZoneMain != null && fromZoneMain.trim().length() > 0 && (fromZoneMain.equalsIgnoreCase("true") || fromZoneMain.equalsIgnoreCase("yes")))
		isFromZoneMain = true;
		
	boolean isFromZoneMenu = false;
	String fromZoneMenu=request.getParameter("isFromZoneMenu");
	if(fromZoneMenu != null && fromZoneMenu.trim().length() > 0 && (fromZoneMenu.equalsIgnoreCase("true") || fromZoneMenu.equalsIgnoreCase("yes")))
		isFromZoneMenu = true;
	
	boolean isFromServiceGroup = false;
	String fromServiceGroup=request.getParameter("isFromServiceGroup");
	if(fromServiceGroup != null && fromServiceGroup.trim().length() > 0 && (fromServiceGroup.equalsIgnoreCase("true") || fromServiceGroup.equalsIgnoreCase("yes")))
		isFromServiceGroup = true;	

	boolean isFirstTimeHit = false;
	String firstTimeHit=request.getParameter("firstTimeHit");
	if(firstTimeHit != null && firstTimeHit.trim().length() > 0 && (firstTimeHit.equalsIgnoreCase("true") || firstTimeHit.equalsIgnoreCase("yes")))
		isFirstTimeHit = true;	

	isFromZone = (isFromZone == null || isFromZone.trim().length() == 0)?"false":isFromZone;
	iniName = (iniName == null || iniName.trim().length() == 0)?"eg_msdashboard":iniName;
	IniFile dashObj = new IniFile(EgInstallInfo.getInstallDir() + "/manager/config/"+iniName+".ini");

	String qry=request.getQueryString();
	
	String compTypeStrT = dashObj.getValue("DASHBOARD_SETTINGS","Component_Type_List");	
	ArrayList msCompTypeList = com.egurkha.util.StringUtils.egTokenizer(compTypeStrT.trim(), ",",false,true,true);		

	UserRegistry registry = UserRegistry.getInstance();
	User user = registry.getUser(session.getId());
	EgUserRole userRole = null;
	boolean isAllCompAccess=false;
	String roleName = null;
	String thisLanguage = "";
	String userName = "admin";
	String subject = "";
	String strWithoutLogin = request.getParameter("without_login");

	if(user==null && strWithoutLogin!=null && (strWithoutLogin.equals("yes") || strWithoutLogin.equals("true")))
	{
		String login_user = request.getParameter("user_name");

		userName=(login_user==null || login_user.trim().length()==0)?"admin":login_user;
		ErUserData userData = new ErUserData(userName,false);
		if(userData==null)
		{
			userName="admin";
			userData = new ErUserData(userName,false);
			user = userData.usr;
		}
		else if(userData!=null)
		{
			user = userData.usr;
		}

		if(user!=null)
		{
			userRole = user.getUserRole();
			roleName = userRole.getRoleName();
			isAllCompAccess = userRole.hasAllComponentAccess();
			thisLanguage = user.getLanguage();
		}
	}
	else if(user!=null)
	{
		userName = user.getLoginID();
		userRole = user.getUserRole();
		isAllCompAccess = userRole.hasAllComponentAccess();
		roleName = userRole.getRoleName();
		thisLanguage = user.getLanguage();
	}
	
	//Getting data from account combo - code started
	boolean isDashboardNameEmpty = true;
	if(dashboard_name != null && !dashboard_name.equalsIgnoreCase("NULL") && dashboard_name.trim().length()>0 )
		isDashboardNameEmpty = false;

	EgMappingInfo mappingInfo = new EgMappingInfo(thisLanguage);
	MonitorUtility mu=new MonitorUtility(user,"eg_commondashboard");	
	MonitorUtilities monUties=new MonitorUtilities(user);	
	
	ArrayList allCompNameList = new ArrayList();
	ArrayList presentComponentTypeList = new ArrayList();
	Hashtable dashboardHash = new Hashtable();	
	Hashtable tempDashboardHash = new Hashtable();	
	
	String hostName = request.getParameter("host");
	String dashboardAccountValue = request.getParameter("accountValue");
	String dashboardAccountName = request.getParameter("accountName");

	if(dashboardAccountName == null || dashboardAccountName.equalsIgnoreCase("NULL"))
		dashboardAccountName = "";	
	String tempDashboardAccountName = dashboardAccountName;

	boolean isDashboardAccountName = false;
	if(dashboardAccountName != null && dashboardAccountName.trim().length()>0 )
		isDashboardAccountName = true;
	
	String title_txt=mappingInfo.getTextDescription("monitor.home.COMPONENTS IN ALL STATES");

	boolean isDashboardCompType = false;
	if(dashboardCompType != null && dashboardCompType.trim().length()>0 )
	{
		isDashboardCompType = true;		

		if(isFromList || isFromMetrics)
		{
			title_txt=(String)mappingInfo.getComponentTypeDescription(dashboardCompType);
			title_txt=title_txt+" "+mappingInfo.getTextDescription("monitor.home.COMPONENTS IN ALL STATES");

			if(selectedState != null && selectedState.trim().length()>0)
			{
				title_txt=(String)mappingInfo.getComponentTypeDescription(dashboardCompType)+" "+mappingInfo.getTextDescription("monitor.home.COMPONENTS IN")+" "+(String)mappingInfo.getLabelDescription(selectedState)+" "+mappingInfo.getTextDescription("monitor.home.STATE");
			}
		}
	}

	boolean isBasedHostName = false;
	if(dashboardCompType != null && !dashboardCompType.equalsIgnoreCase("NULL") && dashboardCompType.trim().length()>0  && hostName != null && !hostName.equalsIgnoreCase("NULL") && hostName.trim().length()>0)
		isBasedHostName = true;
	
	for(int i=0;i<msCompTypeList.size();i++)
	{
		String compTypeName = (String)msCompTypeList.get(i);
		ArrayList compList  = (ArrayList) user.getServersForType(compTypeName);		

		if(compList.size()>0)
		{
			allCompNameList.addAll(compList);
			presentComponentTypeList.add(compTypeName);
		}
				
	}
	//Getting data from account combo - code ended
	//Getting state for all component type - code started
	Hashtable stateMeasure = new Hashtable();
	ArrayList sortedStateList = new ArrayList();
	List compNameListTemp = null;
	if(presentComponentTypeList.size()>0)
	{
		stateMeasure = mu.getOffice365State(presentComponentTypeList,compNameListTemp);
		if(stateMeasure.size()>0)
			sortedStateList = mu.getSortedList(stateMeasure,"^eg^",2);
	}
	//Getting state for all component type - code ended
	
	
	//Based on component names grouping here - code started
	JSONObject accountCombo = new JSONObject();
	JSONObject componentTypeCombo = new JSONObject();
	//initialistaion
	JSONArray emptyDatasArr=new JSONArray();
	componentTypeCombo.put("compTypeCombo",emptyDatasArr);
	componentTypeCombo.put("selectedValue","");

	boolean isdashboardAccountValueEmpty = true;
	if(dashboardAccountValue != null && dashboardAccountValue.trim().length()>0 )
		isdashboardAccountValueEmpty = false;	
	boolean istempDashboardAccountValueEmpty = true;
	if(dashboardAccountValue != null && dashboardAccountValue.trim().length()>0 )
		istempDashboardAccountValueEmpty = false;	
	
	Hashtable oldAgentCompName = new Hashtable();
	Hashtable tempOldAgentCompName = new Hashtable();
	ArrayList oldCompnameList = null;
	ArrayList tempOldCompnameList = new ArrayList();
	boolean isOldAgentCompName = false;
	
	if(isFirstTimeHit)
	{
		int allCompNameListSize = allCompNameList.size();
		Hashtable accountBasedHash = new Hashtable();
		Hashtable tempAccountBasedHash = new Hashtable();
		ArrayList accountNamesList = new ArrayList();
		ArrayList addedDashboardList = new ArrayList();

		//allCompNameList will have component name of all component type - code started
		String alarmsDetailsMenuEnable = dashObj.getValue("DASHBOARD_SETTINGS","AlarmsDetailsMenuEnable");
		boolean isAlarmsDetailsMenuEnable = false;
		if(alarmsDetailsMenuEnable != null && alarmsDetailsMenuEnable.trim().length()>0 && (alarmsDetailsMenuEnable.equalsIgnoreCase("true") || alarmsDetailsMenuEnable.equalsIgnoreCase("yes")))
			isAlarmsDetailsMenuEnable = true;

		if(allCompNameListSize>0)
		{
			String compNameWithPort = "";
			if(isBasedHostName)
				compNameWithPort = dashboardCompType+":"+hostName;
		
			ArrayList accNameList = new ArrayList();
			ArrayList dataCompList = new ArrayList();
			for(int i=0;i<allCompNameListSize;i++)
			{
				isOldAgentCompName = false;
				String compName = (String)allCompNameList.get(i);
				StringTokenizer st=new StringTokenizer(compName,":");
				int count_tok=st.countTokens();
				if(count_tok==3)
				{
					String compType = st.nextToken();
					String trgtHost = st.nextToken();
					String port = st.nextToken();
					
					int indexOfValue = trgtHost.indexOf("_");
					if(indexOfValue>-1 || indexOfValue==-1)
					{
						String accName = trgtHost;	
						if((tempOldCompnameList = (ArrayList)tempOldAgentCompName.get(compType)) != null)			
							tempOldCompnameList.add(accName);						
						else
						{
							tempOldCompnameList = new ArrayList();
							tempOldCompnameList.add(accName);
							tempOldAgentCompName.put(compType,tempOldCompnameList);
						}
						
						if(tempAccountBasedHash.containsKey(accName))
						{
							String dataList = (String) tempAccountBasedHash.get(accName);
							dataList = dataList+","+compName;
							tempAccountBasedHash.put(accName,dataList);
						}
						else
						{												
							tempAccountBasedHash.put(accName,compName);
						}
						if(indexOfValue>-1)
							accName = trgtHost.substring(0,indexOfValue);
						else 
						{
							if((oldCompnameList = (ArrayList)oldAgentCompName.get(compType)) != null)			
								oldCompnameList.add(accName);						
							else
							{
								oldCompnameList = new ArrayList();
								oldCompnameList.add(accName);
								oldAgentCompName.put(compType,oldCompnameList);
							}
							isOldAgentCompName = true;
						}						

						if(isBasedHostName && compName.equalsIgnoreCase(compNameWithPort) && !isDashboardAccountName)
						{
							dashboardAccountName = accName;
							isBasedHostName = false;
							isDashboardCompType = false;
							isDashboardAccountName = true;
							isdashboardAccountValueEmpty = false;
						}
						else if(isDashboardCompType && dashboardCompType.equalsIgnoreCase(compType) && !isDashboardAccountName && !isBasedHostName)
						{
							dashboardAccountName = accName;						
							isDashboardCompType = false;
							isDashboardAccountName = true;
							isdashboardAccountValueEmpty = false;
						}
						if(accountBasedHash.containsKey(accName))
						{
							String dataList = (String) accountBasedHash.get(accName);
							dataList = dataList+","+compName;
							accountBasedHash.put(accName,dataList);
						}
						else
						{												
							accountBasedHash.put(accName,compName);
							accountNamesList.add(accName);
						}						
						
						String tempDashboardName = dashObj.getValue("Component_Type_Mappping",compType);

						//Getting Orginal componentType 
						if(isOldAgentCompName && dashboardCompType != null && dashboardCompType.trim().length()>0)
							tempDashboardName = dashObj.getValue("Component_Type_Mappping",dashboardCompType);

						if(isDashboardAccountName && dashboardAccountName.equals(accName))
						{							
							if(isDashboardNameEmpty)
							{
								dashboard_name = tempDashboardName;
								isDashboardNameEmpty = false;
							}
							
							if(!isDashboardCompType)
							{
								dashboardCompType = compType;
								isDashboardCompType = true;
							}							
							//isDashboardAccountName = false;							
						}
						else if(isDashboardNameEmpty && !isDashboardAccountName)
						{
							dashboard_name = tempDashboardName;
							isDashboardNameEmpty = false;

							if(!isDashboardCompType)
							{
								dashboardCompType = compType;
								isDashboardCompType = true;
							}							
						}
						else if(isOldAgentCompName && isDashboardNameEmpty)
						{
							dashboard_name = tempDashboardName;
							isDashboardNameEmpty = false;
						}

						if(qry.indexOf("&dashboard_name") == -1)
							qry += "&dashboard_name="+dashboard_name;					
						
						if((addedDashboardList=(ArrayList)dashboardHash.get(accName)) != null)	
						{
							if(!addedDashboardList.contains(tempDashboardName))
								addedDashboardList.add(tempDashboardName);						
						}
						else
						{												
							addedDashboardList = new ArrayList();
							addedDashboardList.add(tempDashboardName);
							dashboardHash.put(accName,addedDashboardList);
						}
						if((addedDashboardList=(ArrayList)tempDashboardHash.get(trgtHost)) != null)	
						{
							if(!addedDashboardList.contains(tempDashboardName))
								addedDashboardList.add(tempDashboardName);						
						}
						else
						{												
							addedDashboardList = new ArrayList();
							addedDashboardList.add(tempDashboardName);
							tempDashboardHash.put(trgtHost,addedDashboardList);
						}
						//Alarms details view adding - code started
						if(isAlarmsDetailsMenuEnable && (accNameList.size()==0 || !accNameList.contains(accName)))
						{
							if((addedDashboardList=(ArrayList)dashboardHash.get(accName)) != null)					
								addedDashboardList.add("365AlarmDetailsDashboard");					
							else
							{												
								addedDashboardList = new ArrayList();
								addedDashboardList.add("365AlarmDetailsDashboard");
								dashboardHash.put(accName,addedDashboardList);
							}							
							accNameList.add(accName);
						}
						if(isAlarmsDetailsMenuEnable && (accNameList.size()==0 || !accNameList.contains(trgtHost)))
						{
							if((addedDashboardList=(ArrayList)tempDashboardHash.get(trgtHost)) != null)					
								addedDashboardList.add("365AlarmDetailsDashboard");					
							else
							{												
								addedDashboardList = new ArrayList();
								addedDashboardList.add("365AlarmDetailsDashboard");
								tempDashboardHash.put(trgtHost,addedDashboardList);
							}							
							accNameList.add(trgtHost);
						}
						//Alarms details view adding - code ended
					}				
				}
			}
		}		
		//allCompNameList will have component name of all component type - code ended

		
		//AccountName param will have name of the Dashboard type - code started
		int accountNamesListSize = accountNamesList.size();
		boolean notChecked = false;

		//To support 7.1 below agent version (oldAgentCompName = true) - code started
		if(oldAgentCompName != null && oldAgentCompName.size()>0)
		{
			isOldAgentCompName = true;
			accountNamesList = new ArrayList();
			
			int presentComponentTypeListSize = presentComponentTypeList.size();
			if(presentComponentTypeListSize>0)
			{
				JSONArray datasArr=new JSONArray();
				for(int i=0;i<presentComponentTypeListSize;i++)
				{
					String compTypeName = (String)presentComponentTypeList.get(i);	
					
					JSONObject cTypeObj=new JSONObject();
					cTypeObj.put("name",mappingInfo.getComponentTypeDescription(compTypeName));
					cTypeObj.put("value",compTypeName);
					datasArr.add(cTypeObj);
				}
				componentTypeCombo.put("compTypeCombo",datasArr);
				componentTypeCombo.put("selectedValue",dashboardCompType);
			}

			if((accountNamesList = (ArrayList)tempOldAgentCompName.get(dashboardCompType)) != null && accountNamesList.size()>0)
			{
				accountNamesListSize = accountNamesList.size();
				Collections.sort(accountNamesList);				
				JSONArray datasArr=new JSONArray();

				for(int i=0;i<accountNamesListSize;i++)
				{				
					String accName = (String)accountNamesList.get(i);	
					String val = (String) tempAccountBasedHash.get(accName);
					
					if(istempDashboardAccountValueEmpty)
					{	
						if(istempDashboardAccountValueEmpty && tempDashboardAccountName != null && tempDashboardAccountName.trim().length()>0 && tempDashboardAccountName.equalsIgnoreCase("NULL"))
						{
							dashboardAccountValue = (String) tempAccountBasedHash.get(tempDashboardAccountName);
							istempDashboardAccountValueEmpty = false;
						}
						else if(istempDashboardAccountValueEmpty)
						{						
							dashboardAccountName = accName;
							dashboardAccountValue = val;
							istempDashboardAccountValueEmpty = false;
						}					
					}
					
					JSONObject accValObj=new JSONObject();
					//accValObj.put("name",mappingInfo.getTextDescription("monitor.common."+accName));
					accValObj.put("name",accName);
					accValObj.put("value",val);
					datasArr.add(accValObj);
				}
				accountCombo.put("accountCombo",datasArr);
				accountCombo.put("selectedValue",dashboardAccountValue);
				if(qry.indexOf("&accountName") == -1)
					qry += "&accountName="+dashboardAccountName;
				if(qry.indexOf("&accountValue") == -1)
					qry += "&accountValue="+dashboardAccountValue;
			}
		} //To support 7.1 below agent version (oldAgentCompName = true) - code end
		else if(accountNamesListSize>0)
		{
			isOldAgentCompName = false;
			Collections.sort(accountNamesList);			
			JSONArray datasArr=new JSONArray();
			
			for(int i=0;i<accountNamesListSize;i++)
			{				
				String accName = (String)accountNamesList.get(i);	
				String val = (String) accountBasedHash.get(accName);
				
				if(isdashboardAccountValueEmpty)
				{	
					if(dashboardAccountName != null && dashboardAccountName.trim().length()>0)
					{
						dashboardAccountValue = (String) accountBasedHash.get(dashboardAccountName);
						notChecked = true;
					}
					else
					{						
						dashboardAccountName = accName;
						dashboardAccountValue = val;
						isdashboardAccountValueEmpty = false;
					}				
					notChecked = true;
				}
				else if(!isdashboardAccountValueEmpty && !notChecked)
				{
					dashboardAccountValue = (String) accountBasedHash.get(dashboardAccountName);
					notChecked = true;
				}

				JSONObject accValObj=new JSONObject();
				accValObj.put("name",mappingInfo.getTextDescription("monitor.common."+accName));
				accValObj.put("value",val);
				datasArr.add(accValObj);
			}		
			
			accountCombo.put("accountCombo",datasArr);
			accountCombo.put("selectedValue",dashboardAccountValue);
			if(qry.indexOf("&accountName") == -1)
				qry += "&accountName="+dashboardAccountName;
			if(qry.indexOf("&accountValue") == -1)
				qry += "&accountValue="+dashboardAccountValue;
		}
		//AccountName param will have name of the Dashboard type - code ended
	}
	//Based on component names grouping here - code ended	

	//AccountValue param will have all component name of this dashboard - code started

	ArrayList stateList = new ArrayList();
	HashSet alarmCountcompNameList = new HashSet();
	String cn_str = "";
	String compTypeStr = "";
	//To support 7.1 below agent version (oldAgentCompName = true) - code started

	//Need to component type based alarm event count
	ArrayList compTypeListForAlarmCount = null;  
	if(isOldAgentCompName)
	{
		String tempDashboardName = dashObj.getValue("Component_Type_Mappping",dashboardCompType);
		String dashboardCompTypes = dashObj.getValue("ComponentType_for_DashboardName",tempDashboardName);
		compTypeListForAlarmCount = com.egurkha.util.StringUtils.egTokenizer(dashboardCompTypes.trim(), ",",false,true,true);
	}
	else
		 compTypeListForAlarmCount = new ArrayList();

	//To support 7.1 below agent version (oldAgentCompName = true) - code end

	if(dashboardAccountValue != null && dashboardAccountValue.trim().length()>0)
	{
		ArrayList compNameList =  com.egurkha.util.StringUtils.egTokenizer(dashboardAccountValue, ",",false,true,true);
		
		int compNameListSize = compNameList.size();
		for(int i=0;i<compNameListSize;i++)
		{
			String compName = (String)compNameList.get(i);

			StringTokenizer st=new StringTokenizer(compName,":");
			int count_tok=st.countTokens();
			if(count_tok==3)
			{
				String compType = st.nextToken();
				String trgtHost = st.nextToken();
				String port = st.nextToken();				
				
				//Need to component type based alarm event count - code started
				if(isOldAgentCompName)
				{
					appliesTo = trgtHost+":"+port;

					if(compTypeListForAlarmCount.contains(compType))
					{
						compTypeStr = compTypeStr+",'"+compType+"'";
						cn_str = cn_str +",'"+appliesTo+"'";
						alarmCountcompNameList.add(appliesTo);
					}
					else
						continue;
				}
				//Need to component type based alarm event count - code end
				
				if(!isOldAgentCompName && dashboardCompType != null && dashboardCompType.equals(compType))
					appliesTo = trgtHost+":"+port;

				if(!isOldAgentCompName)
				{
					compTypeStr = compTypeStr+",'"+compType+"'";
					cn_str = cn_str +",'"+trgtHost+":"+port+"'";
					alarmCountcompNameList.add(trgtHost+":"+port);
				}
				
				//Getting state for compType
				String stateValue = mu.getStateValueForO365(stateMeasure,sortedStateList,compType,trgtHost+":"+port);
				if(!stateList.contains(stateValue))
					stateList.add(stateValue);
			}
		}

		if(cn_str.startsWith(","))
			cn_str = cn_str.substring(1);

		if(compTypeStr.startsWith(","))
			compTypeStr = compTypeStr.substring(1);

	}
	//AccountValue param will have all component name of this dashboard - code ended

	String filter = request.getParameter("filter");
	String filterBy = request.getParameter("filterBy");
	String dashTabs = "";
	String time_line = "";
	String title_applies = "";
	String dash_title = "";
	String dashSelectedTab = "";

	time_line = dashObj.getValue(dashboard_name,"Dashboard_Default_Timeline");
	time_line = (time_line == null || time_line.trim().length() == 0)?"2 days":time_line;

	
	if(appliesTo == null || appliesTo.trim().length() ==0)
	{
		String comp_type_need = dashObj.getValue(dashboard_name,"Dashboard_ComponentType");
		if(comp_type_need != null && comp_type_need.trim().length() > 0)
		{
			java.util.List UserComponentList=user.getServersForType(comp_type_need);			
			if(UserComponentList != null && UserComponentList.size() > 0)
			{
				String neeeded_comp = (String)UserComponentList.get(0);
				if(neeeded_comp != null && neeeded_comp.indexOf(":") != -1)
					appliesTo = neeeded_comp.substring(neeeded_comp.indexOf(":")+1);
			}			
		}		
	}	

	title_applies = dashboardAccountName;		
	dash_title = dashObj.getValue(dashboard_name,"Dashboard_Title");
	dash_title = (dash_title == null || dash_title.trim().length() == 0)?"MS OFFICE 365 DASHBOARD":dash_title;
	
	if(title_applies != null && title_applies.trim().length()>0)
		dash_title = mappingInfo.getTextDescription("monitor.common."+dash_title)+" - "+title_applies;

	dashSelectedTab = dashObj.getValue(dashboard_name,"Dashboard_Default_view");
	if(active_view != null && !active_view.trim().equalsIgnoreCase("null") && active_view.trim().length() > 0)
		dashSelectedTab = active_view;
	
	dashSelectedTab=(dashSelectedTab==null || dashSelectedTab.trim().equalsIgnoreCase("null") || dashSelectedTab.trim().length()==0)?"overview_view":dashSelectedTab;
	

	JSONObject dashInfo = new JSONObject();
	JSONArray tabArray = new JSONArray();
	
	String hasMSOffice = null;
	String hasMSMail = null;
	String hasMSSharePoint = null;
	String comp_typeStr = "";
	
	// Getting Alarm Count - code start here
	String higestStateValue = "GOOD";
	int stateListSize = stateList.size();

	if(stateListSize==1)
		higestStateValue = (String)stateList.get(0);
	else if(stateListSize>1)
	{
		higestStateValue = mu.getHigherState(stateList);
	}	
	
	String alarmCount = "0";
	//alarmCount = mu.getAlarmCountO365(alarmCountcompNameList,null);
	EgList tempList = (EgList)monUties.getAlarmsForSelectedComponentType(alarmCountcompNameList,user,cn_str,compTypeStr);
	
	if(tempList != null)
		alarmCount = ""+tempList.size();

	if(alarmCount == null || alarmCount.trim().length() == 0 || alarmCount.equalsIgnoreCase("NULL"))
		alarmCount = "0";
	//Getting Alarm Count - code end here

	if(!isOldAgentCompName && dashboardAccountName != null && dashboardAccountName.trim().length()>0 && dashboardHash.containsKey(dashboardAccountName))
	{
		String alramDashboardStr= "365AlarmDetailsDashboard";
		ArrayList addedDashboardList = (ArrayList)dashboardHash.get(dashboardAccountName);

		//index change -  code started
		if(addedDashboardList != null && addedDashboardList.contains(alramDashboardStr))
		{
			addedDashboardList.remove(alramDashboardStr);
			addedDashboardList.add(alramDashboardStr);
		}
		//index change -  code ended

		for(int j=0;j<addedDashboardList.size();j++)
		{
			String tempDashboard_name = (String)addedDashboardList.get(j);
			dashTabs = dashObj.getValue(tempDashboard_name,"Dashboard_views");
			if(dashTabs != null && dashTabs.trim().length() > 0)
			{		
				String allMenuTabs = "";
				String menuTabs = dashObj.getValue("Dashboard_Menu",tempDashboard_name);	
				
				if(filter!=null && filter.trim().length() != 0 && filter.equalsIgnoreCase("service") && filterBy!=null && filterBy.trim().length() != 0)
				{
					if(hasMSOffice == null && hasMSMail == null && hasMSSharePoint == null)
					{
						HashMap paramsNeeded = getServiceBasedFilter("Service:"+filterBy);
						if(paramsNeeded != null)
						{
							hasMSOffice = (String)paramsNeeded.get("hasMSOffice");
							hasMSMail = (String)paramsNeeded.get("hasMSMail");
							hasMSSharePoint = (String)paramsNeeded.get("hasMSSharePoint");						
							comp_typeStr = (String)paramsNeeded.get("comp_type");						
						}
					}
					if(hasMSOffice != null && hasMSOffice.equalsIgnoreCase("true"))
					{
						if(allMenuTabs != null && allMenuTabs.trim().length() == 0)
							allMenuTabs += menuTabs;
						else
							allMenuTabs += ","+menuTabs;
					}
					if(hasMSMail != null && hasMSMail.equalsIgnoreCase("true")){

						if(allMenuTabs != null && allMenuTabs.trim().length() == 0)
							allMenuTabs += menuTabs;
						else
							allMenuTabs += ","+menuTabs;
					}
					if(hasMSSharePoint != null && hasMSSharePoint.equalsIgnoreCase("true")){

						if(allMenuTabs != null && allMenuTabs.trim().length() == 0)
							allMenuTabs += menuTabs;
						else
							allMenuTabs += ","+menuTabs;
					}
				}
				else
				{				
						if(allMenuTabs != null && allMenuTabs.trim().length() == 0)
							allMenuTabs += menuTabs;
						else
							allMenuTabs += ","+menuTabs;					
				}
				
				String childrenTabs = "";
				if(allMenuTabs != null && allMenuTabs.indexOf("!~!") > -1)
				{	
					childrenTabs = allMenuTabs.substring(allMenuTabs.indexOf("!~!")+3);
					allMenuTabs = allMenuTabs.substring(0,allMenuTabs.indexOf("!~!"));			
				}
				ArrayList tabDetails =  com.egurkha.util.StringUtils.egTokenizer(allMenuTabs.trim(), ",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
				ArrayList childtabDetails =  com.egurkha.util.StringUtils.egTokenizer(childrenTabs.trim(), ",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
				if(tabDetails != null && tabDetails.size() > 0)
				{					
					for(int l=0;l<tabDetails.size();l++)
					{
						JSONArray tabArray_child = new JSONArray();
						String tabInfos = (String)tabDetails.get(l);				
						if(tabInfos != null && tabInfos.trim().length() > 0)
						{
							ArrayList tabInfoDetails =  com.egurkha.util.StringUtils.egTokenizer(tabInfos.trim(), ":",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
							
							if(tabInfoDetails != null && tabInfoDetails.size() == 4)
							{
								String itemId = (String)tabInfoDetails.get(0);
								String caption = (String)tabInfoDetails.get(1);						
								String captionl = mappingInfo.getTextDescription("monitor.common."+caption);
								String menu_iconCls = (String)tabInfoDetails.get(2);
								String meanuCompType = (String)tabInfoDetails.get(3);

								JSONObject tab = new JSONObject();
								tab.put("id",itemId);
								String str = caption.replace(" " , "");
								tab.put("caption",str.toLowerCase());
								tab.put("display","none");
								if(captionl.equalsIgnoreCase("All Events"))
								{
									if(alarmCount.trim().length() == 0 || alarmCount.equalsIgnoreCase("0"))
									{
										tab.put("captionTitle",captionl);
										tab.put("menu_iconCls",menu_iconCls);
										tab.put("state",higestStateValue);
										tab.put("display","none");
									}
									else
									{
										tab.put("captionTitle",captionl+" ("+alarmCount+")");
										tab.put("menu_iconCls",menu_iconCls);
										tab.put("state",higestStateValue);
										tab.put("display","block");										
									}									
								}
								else
								{
									tab.put("captionTitle",captionl);
									tab.put("menu_iconCls",menu_iconCls);
								}
								tab.put("type",meanuCompType);
								if(childtabDetails != null && childtabDetails.size() > 0)
								{					
									for(int lc=0;lc<childtabDetails.size();lc++)
									{
										String childtabInfos = (String)childtabDetails.get(lc);				
										if(childtabInfos != null && childtabInfos.trim().length() > 0)
										{
											ArrayList childtabInfoDetails =  com.egurkha.util.StringUtils.egTokenizer(childtabInfos.trim(), ":",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
											
											if(childtabInfoDetails != null && childtabInfoDetails.size() == 4)
											{
												String itemId_child = (String)childtabInfoDetails.get(0);
												String caption_child = (String)childtabInfoDetails.get(1);						
												String captionl_child = mappingInfo.getTextDescription("monitor.common."+caption_child);
												String menu_iconCls_child = (String)childtabInfoDetails.get(2);
												String meanuCompType_child = (String)childtabInfoDetails.get(3);

												JSONObject tab_child = new JSONObject();
												tab_child.put("id",itemId_child);
												String str_child = caption_child.replace(" " , "");
												tab_child.put("caption",str_child.toLowerCase());
												tab_child.put("captionTitle",captionl_child);
												tab_child.put("menu_iconCls",menu_iconCls_child);
												tab_child.put("type",meanuCompType_child);											
												tabArray_child.add(tab_child);
											}
										}									
									}								
								}	
								tab.put("children",tabArray_child);
								tabArray.add(tab);
							}							
						}
					}
				}
			}
		}
	}
	else if(isOldAgentCompName && dashboardAccountName != null && dashboardAccountName.trim().length()>0 && tempDashboardHash.containsKey(dashboardAccountName))
	{
		String alramDashboardStr= "365AlarmDetailsDashboard";
		ArrayList addedDashboardList = (ArrayList)tempDashboardHash.get(dashboardAccountName);

		//index change -  code started
		if(addedDashboardList != null && addedDashboardList.contains(alramDashboardStr))
		{
			addedDashboardList.remove(alramDashboardStr);
			addedDashboardList.add(alramDashboardStr);
		}
		else if(addedDashboardList != null && !addedDashboardList.contains(alramDashboardStr))	
			addedDashboardList.add(alramDashboardStr);
		
		//index change -  code ended

		for(int j=0;j<addedDashboardList.size();j++)
		{
			String tempDashboard_name = (String)addedDashboardList.get(j);
			dashTabs = dashObj.getValue(tempDashboard_name,"Dashboard_views");
			if(dashTabs != null && dashTabs.trim().length() > 0)
			{		
				String allMenuTabs = "";
				String menuTabs = dashObj.getValue("Dashboard_Menu",tempDashboard_name);	
				if(filter!=null && filter.trim().length() != 0 && filter.equalsIgnoreCase("service") && filterBy!=null && filterBy.trim().length() != 0)
				{
					if(hasMSOffice == null && hasMSMail == null && hasMSSharePoint == null)
					{
						HashMap paramsNeeded = getServiceBasedFilter("Service:"+filterBy);
						if(paramsNeeded != null)
						{
							hasMSOffice = (String)paramsNeeded.get("hasMSOffice");
							hasMSMail = (String)paramsNeeded.get("hasMSMail");
							hasMSSharePoint = (String)paramsNeeded.get("hasMSSharePoint");						
							comp_typeStr = (String)paramsNeeded.get("comp_type");						
						}
					}
					if(hasMSOffice != null && hasMSOffice.equalsIgnoreCase("true"))
					{
						if(allMenuTabs != null && allMenuTabs.trim().length() == 0)
							allMenuTabs += menuTabs;
						else
							allMenuTabs += ","+menuTabs;
					}
					if(hasMSMail != null && hasMSMail.equalsIgnoreCase("true")){

						if(allMenuTabs != null && allMenuTabs.trim().length() == 0)
							allMenuTabs += menuTabs;
						else
							allMenuTabs += ","+menuTabs;
					}
					if(hasMSSharePoint != null && hasMSSharePoint.equalsIgnoreCase("true")){

						if(allMenuTabs != null && allMenuTabs.trim().length() == 0)
							allMenuTabs += menuTabs;
						else
							allMenuTabs += ","+menuTabs;
					}
				}
				else
				{				
						if(allMenuTabs != null && allMenuTabs.trim().length() == 0)
							allMenuTabs += menuTabs;
						else
							allMenuTabs += ","+menuTabs;					
				}
				
				String childrenTabs = "";
				if(allMenuTabs != null && allMenuTabs.indexOf("!~!") > -1)
				{	
					childrenTabs = allMenuTabs.substring(allMenuTabs.indexOf("!~!")+3);
					allMenuTabs = allMenuTabs.substring(0,allMenuTabs.indexOf("!~!"));			
				}
				ArrayList tabDetails =  com.egurkha.util.StringUtils.egTokenizer(allMenuTabs.trim(), ",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
				ArrayList childtabDetails =  com.egurkha.util.StringUtils.egTokenizer(childrenTabs.trim(), ",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
				if(tabDetails != null && tabDetails.size() > 0)
				{					
					for(int l=0;l<tabDetails.size();l++)
					{
						JSONArray tabArray_child = new JSONArray();
						String tabInfos = (String)tabDetails.get(l);				
						if(tabInfos != null && tabInfos.trim().length() > 0)
						{
							ArrayList tabInfoDetails =  com.egurkha.util.StringUtils.egTokenizer(tabInfos.trim(), ":",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
							
							if(tabInfoDetails != null && tabInfoDetails.size() == 4)
							{
								String itemId = (String)tabInfoDetails.get(0);
								String caption = (String)tabInfoDetails.get(1);						
								String captionl = mappingInfo.getTextDescription("monitor.common."+caption);
								String menu_iconCls = (String)tabInfoDetails.get(2);
								String meanuCompType = (String)tabInfoDetails.get(3);

								JSONObject tab = new JSONObject();
								tab.put("id",itemId);
								String str = caption.replace(" " , "");
								tab.put("caption",str.toLowerCase());
								tab.put("display","none");
								if(captionl.equalsIgnoreCase("All Events"))
								{
									if(alarmCount.trim().length() == 0 || alarmCount.equalsIgnoreCase("0"))
									{
										tab.put("captionTitle",captionl);
										tab.put("menu_iconCls",menu_iconCls);
										tab.put("state",higestStateValue);
										tab.put("display","none");
									}
									else
									{
										tab.put("captionTitle",captionl+" ("+alarmCount+")");
										tab.put("menu_iconCls",menu_iconCls);
										tab.put("state",higestStateValue);
										tab.put("display","block");										
									}									
								}
								else
								{
									tab.put("captionTitle",captionl);
									tab.put("menu_iconCls",menu_iconCls);
								}
								tab.put("type",meanuCompType);
								if(childtabDetails != null && childtabDetails.size() > 0)
								{					
									for(int lc=0;lc<childtabDetails.size();lc++)
									{
										String childtabInfos = (String)childtabDetails.get(lc);				
										if(childtabInfos != null && childtabInfos.trim().length() > 0)
										{
											ArrayList childtabInfoDetails =  com.egurkha.util.StringUtils.egTokenizer(childtabInfos.trim(), ":",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
											
											if(childtabInfoDetails != null && childtabInfoDetails.size() == 4)
											{
												String itemId_child = (String)childtabInfoDetails.get(0);
												String caption_child = (String)childtabInfoDetails.get(1);						
												String captionl_child = mappingInfo.getTextDescription("monitor.common."+caption_child);
												String menu_iconCls_child = (String)childtabInfoDetails.get(2);
												String meanuCompType_child = (String)childtabInfoDetails.get(3);

												JSONObject tab_child = new JSONObject();
												tab_child.put("id",itemId_child);
												String str_child = caption_child.replace(" " , "");
												tab_child.put("caption",str_child.toLowerCase());
												tab_child.put("captionTitle",captionl_child);
												tab_child.put("menu_iconCls",menu_iconCls_child);
												tab_child.put("type",meanuCompType_child);											
												tabArray_child.add(tab_child);
											}
										}									
									}								
								}	
								tab.put("children",tabArray_child);
								tabArray.add(tab);
							}							
						}
					}
				}
			}
		}
	}
	dashInfo.put("tabArray",tabArray);
	dashInfo.put("selectedTab",dashSelectedTab);
	dashInfo.put("dash_title",dash_title);
	
	if(((dashboard_name != null && dashboard_name.equalsIgnoreCase("MS_Teams_Dashboard")) || (dashboardCompType!= null && dashboardCompType.equalsIgnoreCase("Microsoft_Teams"))) && activeView != null && activeView.equalsIgnoreCase("overview_view"))
	{
		activeView = "service_health_view";
	}

	//Refresh Frequency - Deafult 1 minitue - code started
	//NOTE: u_ser obj from EgLoginTracker.jsp

	long refreshFrequency = 60 * 1000L;
	//String refFreq = u_ser.getRefreshFrequency();
	String refFreq = dashObj.getValue("DASHBOARD_SETTINGS","RefreshFrequency");

	if(refFreq!=null && refFreq.length()>0)
	{
		refreshFrequency =  Long.valueOf(refFreq).longValue() * 1000L;
	}
	
	//Refresh Frequency - code started

	IniFile iniUiObj = new IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_ui.ini");
	String myServerName = request.getScheme() + "://" +request.getServerName();	
%>

<!DOCTYPE html>
<html id="msdashboard">
<head>
<meta charset="UTF-8">
<title>eG Manager- MICROSOFT DASHBOARD</title>
<script src="/final/scripts/eg_DateUtil.js" type='text/javascript'></script>	
<egui:skin ui="monitor"/>
<script src="/final/jquery/jquery.js"></script>
<script src="/final/monitor/eg_scripts/eg_date.js"></script>
<script src="/final/Highcharts/js/highstock.js"></script>
<script  src="/final/extjs/ext-all.js"></script>
<script  src="/final/monitor/eg_scripts/microsoftDashboard/app.js"></script>
<script  src="/final/monitor/eg_scripts/EgCitrixDashboardHighChart.js"></script>
<link rel="stylesheet" href="/final/monitor/eg_scripts/microsoftDashboard/css/microsoft<%=monitor_Skin%>.css" />
<script>
	
	function setSession(view_name,dashboardName,compType)
	{
		Ext.Ajax.request({
			url :'/final/monitor/microsoftDashboard.jsp?setSession=true&active_view='+view_name+'&dashboard_name='+dashboardName+"&compType="+compType,
			scope:this,
			async:true,
			success: function(response){
			}
		});
	}

	var strSkin='<%=monitor_Skin%>';
	var iniName="<%=iniName%>";
	var user_name="<%=userName%>";
	var dashboard="<%=dashboard_name%>";
	var refreshFrequency="<%=refreshFrequency%>";
	var requestParams=new Object();
	var dashInfo=<%=dashInfo%>;
	
	
	requestParams.dashboardCompType="<%=dashboardCompType%>";

	requestParams.accComboObj=<%=accountCombo%>;	
	requestParams.componentTypeComboObj=<%=componentTypeCombo%>;
	requestParams.fromList="<%=fromList%>";
	requestParams.isFromHomepage=<%=isFromHomepage%>;
	requestParams.isFromMenu=<%=isFromMenu%>;
	requestParams.isFromList=<%=isFromList%>;
	requestParams.isFromMetrics=<%=isFromMetrics%>;
	requestParams.viewPageTitle="<%=title_txt%>";
	requestParams.selectedState="<%=selectedState%>";
	requestParams.isOldAgentCompName=<%=isOldAgentCompName%>;

	requestParams.time_line="<%=time_line%>";

	requestParams.selectedTab = "<%=activeView%>";
	requestParams.dashboard = dashboard;
	var mgrDateFormat = getExtjsDateFormat('<%=dateFormatForDatePicker%>');

</script>

</head>
<body> 
<input type="hidden" name="isSessionWindowOpen" id="isSessionWindowOpen" value="false" />
</body>

</html>

<%
	if(qry!=null)
	{
		qry=com.egurkha.util.StringUtils.replace(qry, "\\", "\\\\");
		session.setAttribute("monitorLastSession","/final/monitor/microsoftDashboard.jsp?"+qry);
	}
	else
		session.setAttribute("monitorLastSession","/final/monitor/microsoftDashboard.jsp");

%>