<!DOCTYPE html>

<%@ page import = "com.eg.EgURLDecoder"%>
<%@ 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"%>
<%
	String viewFrom = request.getParameter("viewFrom");
	if(viewFrom == null || viewFrom.trim().length() == 0)
		viewFrom = "default";
	String s_agentType = request.getParameter("agentType");
	String s_agentStatus = request.getParameter("agentStatus");
	String agentID = "";
	String temp = request.getParameter("componentName");
	if(temp != null && temp.length()>0)
		agentID = EgURLDecoder.decode(request.getParameter("componentName"),"UTF-8");
	String showAgentInformationView = request.getParameter("showAgentInformationView");
%>
<html>
<head>
<meta charset="utf-8">
<script>
	var componentName = '<%=agentID%>';
	var viewFrom = '<%=viewFrom%>';
	var agentType = '<%=s_agentType%>';
	var agentStatus = '<%=s_agentStatus%>';
</script>

	<!--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>
	<link rel="stylesheet" href="/final/styles/jscrollpane/jquery.jscrollpane.css"/>

	<script type="text/javascript" src="/final/admin/AgentXmx/app/app.js"></script>

	<script language="JavaScript" src="eg_scripts/validate.js"></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>

	<script language="JavaScript1.2">
		var csrfToken = '<%=strCsrfToken%>';
		var agentNick = '<egui:intnl text="admin.agents.Agent IP/Nickname"/>';
		var current_XmxValue = '<egui:intnl text="admin.agents.Existing Xmx value"/> (MB)';
		var new_XmxValue = '<egui:intnl text="admin.agents.New Xmx value"/> (MB)';

		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 emptyAlert='<egui:intnl text="admin.common.New Xmx value cannot be empty"/>';
		var spaceAlert='<egui:intnl text="admin.common.New Xmx value should not contain space"/>';
		var numberAlert='<egui:intnl text="admin.common.New Xmx value should contain only integers"/>';
		var negativeAlert='<egui:intnl text="admin.common.New Xmx value should be greater than 255"/>';
		var sameValueAlert='<egui:intnl text="admin.common.New and old Xmx values are equal"/>';
		var pleaseAlert='<egui:intnl text="admin.common.This process may take few minutes"/>';
		var timeoutAlert='<egui:intnl text="admin.common.Failed to get required information from the agent"/>';
		var Back = '<egui:intnl text="admin.common.BACK"/>';
		var PageDesc = '<egui:intnl description="EgAgentXmxView.jsp"/>';
		var pageName = '<egui:intnl text="admin.title.AGENT XMX"/>';
		var showAgentInformationView = '<%=showAgentInformationView%>';
		var restartAlert='<egui:intnl text="admin.common.This operation will automatically restart the agent"/>. <egui:intnl text="admin.common.Do you want to proceed"/>?';
		var updatedMessage='<egui:intnl text="admin.common.Xmx value has been updated successfully"/>';
		var agentID = '<%=agentID%>';
		var xmxUnit = 'm';
	</script>
</head>
<body>
<div id="loadmask" class="x-mask-msg x-layer x-mask-msg-default" style="z-index: 19001;left:45%;top:35%;">
	<div class="x-mask-loading" style="position:relative">
		Loading...
	</div>
</div>
</body>
</html>
<%
	if(request.getQueryString()!= null)
	{
		session.setAttribute("adminLastAccessedURL","/final/admin/EgAgentXmxView.jsp?"+request.getQueryString());
	}
	else
	{
		session.setAttribute("adminLastAccessedURL","/final/admin/EgAgentXmxView.jsp");
	}
%>



