<!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 agentID = request.getParameter("componentName");
	if(agentID != null && agentID.length()>0)
		agentID = EgURLDecoder.decode(agentID,"UTF-8");

	String fileName = request.getParameter("file");
	if(fileName == null || fileName.length() == 0)
		fileName = "error_log";
	String showAgentInformationView = request.getParameter("showAgentInformationView");
	String isdebugEnabled = request.getParameter("debug");
	String viewFrom = request.getParameter("viewFrom");
	if(viewFrom == null || viewFrom.trim().length() == 0)
		viewFrom = "default";
	String agentState = request.getParameter("agentStatus");
	String agentType = request.getParameter("agentType");
	if(agentType == null || agentType.trim().length() == 0)
	{
		agentType = "PremiumAgents";
	}
%>
<html>
<head>
<meta charset="utf-8">
<script>
	var componentName = '<%=agentID%>';
	var fileName = '<%=fileName%>';
	var selectedType = '<%=agentType%>';
	var agentState = '<%=agentState%>';
</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/Agentlog/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 lbl_AgentType = '<egui:intnl text="admin.agents.Agent type"/>';
		var lbl_AgentIP = '<egui:intnl text="admin.agents.Agent IP/Nickname"/>';
		var lbl_LogFileDir = '<egui:intnl text="admin.agents.Log file directory"/>';
		var lbl_LogFileName = '<egui:intnl text="admin.agents.Log file name"/>';
		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 pageTitle = '<egui:intnl text="admin.title.AGENTS - LOGS"/>';

		var Back = '<egui:intnl text="admin.common.BACK"/>';
		var PageDesc = '<egui:intnl description="EgAgentLogView.jsp"/>';
		var pageName = '<egui:intnl text="admin.title.AGENT LOGS"/>';
		var showAgentInformationView = '<%=showAgentInformationView%>';
		var agentID = '<%=agentID%>';
		var viewFrom = '<%=viewFrom%>';
		var isdebugEnabled = '<%=isdebugEnabled%>';
		var s_Agent_Type = '<%=agentType%>';
	</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/EgAgentLogView.jsp?"+request.getQueryString());
	}
	else
	{
		session.setAttribute("adminLastAccessedURL","/final/admin/EgAgentLogView.jsp");
	}
%>


