<!DOCTYPE html>

<%@ include file = "EgTrackerA.jsp"%>
<%@ taglib prefix="egui" uri="../WEB-INF/eg-taglib.tld"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

<%
	IniFile egUI = new IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/eg_ui.ini");
	String currentDateFormat = egUI.getValue("CURRENT_DATE_FORMAT","selectedDateFormat");
	String userDtFormat = _user.getUserDateFormat();
	if (userDtFormat.equalsIgnoreCase("default") || userDtFormat.length() == 0)
	{
		userDtFormat = currentDateFormat;
	}
	String extjsDateFormat = egUI.getValue("EXTJS_DATE_FORMATS",userDtFormat);
	if (extjsDateFormat != null && extjsDateFormat.length() > 0)
	{
		extjsDateFormat = extjsDateFormat+" H:i:s";
	}
	else
	{
		extjsDateFormat = "M d, Y H:i:s";
	}
%>

<html>
<head>
	
	<meta charset="utf-8">

	<!--Skin color--------->
	<egui:skin ui = "admin"/>

	<!---Components, icons, skin and Core ext script--->
	<script type="text/javascript" src="../extjs/ext-all.js"></script>

	<!-- Fancy Scroll-->
	<script src="/final/jquery/jquery.js"></script>
	<script src="/final/styles/jscrollpane/jquery.jscrollpane.js" ></script>
	<script src="/final/styles/jscrollpane/jquery.mousewheel.js" ></script>
	<script src="/final/styles/jscrollpane/mwheelIntent.js" ></script>
	<script src="/final/scripts/utilities/EncodeDecodeParams.js"></script>
	<link rel="stylesheet" href="/final/styles/jscrollpane/jquery.jscrollpane.css"/>

	<!-- Application folder -->
	<script type="text/javascript" src="AdvanceSearch/app/app.js"></script>

	<script type="text/javascript">
		var extjsDateFormat = '<%=extjsDateFormat%>';
		var csrfToken = '<%=strCsrfToken%>';
		var pageTitle = '<egui:intnl text="admin.common.AGENTS UPGRADE - ADVANCED SEARCH"/>';
		var pageDesc = '<egui:intnl description="AdvanceSearch.jsp"/>';
		var selectedAgentIDs=""; 
		var g_label=""; 
		var default_upgrade_now_enabled="";
		<%String sessId = session.getId();%>
		var sessionId = '<%=sessId%>';
		var refreshTime = '';
		var appCtn = '';
		var publicJSON='';
		var componentName = '<egui:intnl text="admin.common.Component/Agent name"/>';
		var componenttype = '<egui:intnl text="admin.common.Component/Agent type"/>';
		var Status = '<egui:intnl text="admin.common.Status"/>';
		var From = '<egui:intnl text="admin.common.From IP address"/>';
		var To = '<egui:intnl text="admin.common.To IP address"/>';
		var FromIP_notValid='<egui:intnl text="admin.upgrade.From IP Address is not valid" />';
		var ToIP_notValid='<egui:intnl text="admin.upgrade.To IP Address is not valid" />';
		var Empty_fields='<egui:intnl text="admin.upgrade.From field cannot be empty" />';
		var Invalid_range='<egui:intnl text="admin.upgrade.Invalid range" />';
		var agent_msg= '<egui:intnl text="admin.upgrade.Some of the agents that you have selected have auto upgrade disabled"/>. <egui:intnl text="admin.Are you sure you want to upgrade all selected agents now?"/>';
		var agentNotSelected= '<egui:intnl text="admin.upgrade.No agent(s) have been selected" />';
		var refreshButtonValue="1";

		var probsErrorMessage = '<egui:intnl text="admin.error.Problem encountered while loading the user interface"/>';
		var requestTimeOut = '<egui:intnl text="admin.error.Response timed out"/>';
		var errorTitle = '<egui:intnl text="admin.user.Error"/>';
		var setAutoUpgradeLabel='<egui:intnl text="admin.upgrade.Set Auto Upgrade"/>';
		var disableAutoUpgradeLabel='<egui:intnl text="admin.upgrade.Disable Auto Upgrade"/>';
		var upgradeNowLabel='<egui:intnl text="admin.upgrade.Upgrade Now"/>';
		var cancelUpgradeNowLabel='<egui:intnl text="admin.upgrade.Cancel Upgrade Now"/>';
		var setTimeLabel='<egui:intnl text="admin.upgrade.Next Refresh in"/> : ';
		var componentNameLabel='<egui:intnl text="admin.upgrade.Component/ Agent Name"/>';
		var componentTypeLabel='<egui:intnl text="admin.upgrade.Component/ Agent Type"/>';
		var agentNameLabel='<egui:intnl text="admin.upgrade.Agent Name"/>';
		var autoUpgradeLabel='<egui:intnl text="admin.upgrade.Auto Upgrade"/>';
		var versionLabel='<egui:intnl text="admin.upgrade.Version"/>';
		var operatingSystemLabel='<egui:intnl text="admin.upgrade.Agent Operating System"/>';
		var lastUpgradePackageLabel='<egui:intnl text="admin.upgrade.Last Upgrade Package"/>';
		var lastUpgradeTimeLabel='<egui:intnl text="admin.upgrade.Last Upgrade  Time"/>';
		var hourLabel='<egui:intnl text="admin.upgrade.Hr"/>';
		var hoursLabel='<egui:intnl text="admin.upgrade.Hrs"/>';
		var minLabel='<egui:intnl text="admin.upgrade.Min"/>';
		var minsLabel='<egui:intnl text="admin.upgrade.Mins"/>';
		var secLabel='<egui:intnl text="admin.upgrade.Sec"/>';
		var secsLabel='<egui:intnl text="admin.upgrade.Secs"/>';
		var setAutoUpgradeResult= '<egui:intnl text="admin.Auto upgrade has been enabled successfully" />';
		var disableAutoUpgradeResult= '<egui:intnl text="admin.upgrade.Auto upgrade has been disabled successfully" />';
		var upgradeNowResult= '<egui:intnl text="admin.upgrade.Upgrade now been enabled successfully" />';
		var cancelUpgradeNowResult= '<egui:intnl text="admin.upgrade.Upgrade now has been disabled successfully" />';
		var noAgents= '<egui:intnl text="admin.upgrade.No agent(s) found for your current selection"/>';
		var agent_version = '<egui:intnl text="admin.upgrade.Agent version"/>';
		var agent_os = '<egui:intnl text="admin.upgrade.Operating System"/>';

		var searchCriteria = '<egui:intnl text="admin.common.Search criteria"/>';
		var topicsLabel = '<egui:intnl text="admin.common.Displaying topics"/>';
		var emptyLabel = '<egui:intnl text="admin.common.No topics to display"/>';
		var pageLabel = '<egui:intnl text="admin.common.Page"/>';
		var ofLabel = '<egui:intnl text="admin.common.of"/>';

		var componentLabel = '<egui:intnl text="admin.upgrade.Component/Agent Type"/>';
		var IP_addressLabel = '<egui:intnl text="admin.upgrade.IP Address"/>';
		var componentGroupLabel = '<egui:intnl text="admin.upgrade.Component Group"/>';

	</script>

	<script language="javascript">
		Ext.onReady(function(){
			Ext.Ajax.extraParams = {"com.eg.CSRF_NONCE" : csrfToken};
			Ext.data.Connection.prototype.extraParams = {"com.eg.CSRF_NONCE" : csrfToken};
			Ext.data.ScriptTagProxy.prototype.extraParams = {"com.eg.CSRF_NONCE" : csrfToken};

			Ext.Ajax.on('requestexception', function (conn, response, options) {
				var errorStr = response.responseText;
				if (errorStr != undefined && errorStr != 'undefined' && errorStr.indexOf("customerror") != -1)
				{
					if (errorStr.indexOf("user-session-invalid") != -1)
					{
						callWindow(1);
					}
					else if (errorStr.indexOf("user-deleted") != -1)
					{
						callWindow(2);
					}
					else if (errorStr.indexOf("user-timedout") != -1)
					{
						callWindow(3);
					}
				}
				else
				{
					if (response.status == 302 || (response.timedout != undefined && response.timedout == true))
					{
						Ext.Msg.show({
							title : errorTitle,
							msg : requestTimeOut+'.',
							buttons : Ext.Msg.OK,
							icon : 'iconError'
						});
					}
					else
					{
						console.log(response.responseText);
						Ext.Msg.show({
							title : errorTitle,
							msg : probsErrorMessage+'.',
							buttons : Ext.Msg.OK,
							icon : 'iconError'
						});
					}
				}
			});
		});
	</script>

</head>
<body>

</body>
</html>

<%
	if(request.getQueryString()!=null)
	{
		session.setAttribute("adminLastAccessedURL","/final/admin/AdvanceSearch.jsp?"+request.getQueryString());
	}
	else 
	{
		session.setAttribute("adminLastAccessedURL","/final/admin/AdvanceSearch.jsp");
	}
%>



