
<%@ 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"%>
<%
	response.setHeader("Cache-Control","no-store");
	response.setHeader("Pragma","no-cache");
	response.setDateHeader("Expires", -1);
%>
<html>
<head>
	<meta charset="utf-8">

	<egui:skin ui="admin"/>

	<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"/>

	<script language="JavaScript1.2">
		var csrfToken = '<%=strCsrfToken%>';
		var pageTitle = '<egui:intnl text="admin.title.List Of Managers"/>';
		var pageDesc = '<egui:intnl description="EgDispManagers.jsp"/>';
		var addOrModifyPageDesc = '<egui:intnl description="EgConfigManager.jsp"/>';
		var backBtn = '<egui:intnl text="admin.title.Back"/>';
		var addManagerViewTitle = '<egui:intnl text="admin.manager.Configure - Manager"/> >> <egui:intnl text="admin.manager.Add"/>';
		var modifyManagerViewTitle = '<egui:intnl text="admin.manager.Configure - Manager"/> >> <egui:intnl text="admin.manager.Modify"/>';

		//labels used in manager names grid
		var configuredManagersLabel = '<egui:intnl text="admin.manager.Configured Managers"/>';
		var managedManagersLabel = '<egui:intnl text="admin.title.Managers"/>';
		var unmanagedManagersLabel = '<egui:intnl text="admin.title.Unconfigured Managers"/>';
		var managerNicknameLabel = '<egui:intnl text="admin.title.Manager Nickname"/>';
		var managerTypeLabel = '<egui:intnl text="admin.title.Manager Type"/>';
		var managerStatusLabel = '<egui:intnl text="admin.title.Status"/>';
		var managerRunningLabel = '<egui:intnl text="admin.manager.Manager Running"/>';
		var managerNotRunningLabel = '<egui:intnl text="admin.manager.Manager Not Running"/>';
		var manageManagerLabel = '<egui:intnl text="admin.manager.Configure"/>';
		var manageManagersLabel = '<egui:intnl text="admin.manager.Configure All"/>';
		var unmanageManagerLabel = '<egui:intnl text="admin.manager.Unconfigure"/>';
		var unmanageManagersLabel = '<egui:intnl text="admin.manager.Configure All"/>';
		var deleteManagerLabel = '<egui:intnl text="admin.manager.Delete"/>';
		var deleteManagersLabel = '<egui:intnl text="admin.manager.Delete All"/>';

		//labels used in add and modify manager
		var addManagerLabel = '<egui:intnl text="admin.title.Add New Manager"/>';
		var updateManagerLabel = '<egui:intnl text="admin.title.Modify Manager"/>';
		var managerIdLabel = '<egui:intnl text="admin.manager.Manager ID (Nickname)"/>';
		var managerIpHostnameLabel = '<egui:intnl text="admin.manager.Hostname/IP Address"/>';
		var portNoLabel = '<egui:intnl text="admin.manager.Port No"/>';
		var sslLabel = '<egui:intnl text="admin.manager.SSL"/>';
		var yesLabel = '<egui:intnl text="admin.common.Yes"/>';
		var noLabel = '<egui:intnl text="admin.common.No"/>';
		var createdTimeLabel = '<egui:intnl text="admin.common.Created Time"/>';
		var lastAccessedTimeLabel = '<egui:intnl text="admin.common.Last Accessed Time By SuperManager"/>';
		var secondaryMgrInfoLabel = '<egui:intnl text="admin.manager.Secondary Managers Information for"/>';
		var addButtonLabel = '<egui:intnl text="admin.manager.Add"/>';
		var updateButtonLabel = '<egui:intnl text="admin.manager.Update"/>';
		var deleteManagerMessage = '<egui:intnl text="admin.manager.Are you sure you want to delete the selected manager? This change is permanent and cannot be recovered"/>';
		var deleteManagersMessage = '<egui:intnl text="admin.manager.Are you sure you want to delete the selected managers? This change is permanent and cannot be recovered"/>';
		var manageManagerMessage = '<egui:intnl text="admin.manager.Are you sure you want to configure the selected manager"/>?';
		var manageManagersMessage = '<egui:intnl text="admin.manager.Are you sure you want to configure the selected managers"/>?';
		var unmanageManagerMessage = '<egui:intnl text="admin.manager.Are you sure you want to unconfigure the selected manager"/>?';
		var unmanageManagersMessage = '<egui:intnl text="admin.manager.Are you sure you want to unconfigure the selected managers"/>?';
		var managerDetailsNotChanged = '<egui:intnl text="admin.manager.No manager details changed"/>';
		var noManagersSelected = '<egui:intnl text="admin.manager.No managers selected"/>';
		var noManagersConfig = '<egui:intnl text="admin.manager.Managers have not been configured"/>';
		var noManagersNicknames = '<egui:intnl text="admin.manager.No manager nick names found for your current search"/>.';
		var noUnmanagersNicknames = '<egui:intnl text="admin.manager.No unconfigured manager nick names found for your current search"/>.';
		var managerIdEmpty = '<egui:intnl text="admin.manager.Manager ID (Nickname) can not be empty"/>';
		var managerURLLabel = '<egui:intnl text="admin.manager.Manager URL"/>';
		var alternateURLLabel = '<egui:intnl text="admin.manager.Alternate Manager URLs"/>';
		var secondaryManagerURLLabel = '<egui:intnl text="admin.manager.Secondary Manager URL"/>';
		var secondaryNatURLLabel = '<egui:intnl text="admin.manager.Secondary Manager NAT URL"/>';

		//labels used in form validation
		var spaceFound = '<egui:intnl text="admin.manager.Space is not allowed"/>';
		var dotsFound = '<egui:intnl text="admin.manager.Dot is not allowed"/>';
		var splCharsFound = '<egui:intnl text="admin.manager.Special character are not allowed"/>';
		var spaceFound = '<egui:intnl text="admin.manager.Space is not allowed"/>';
		var reseredWord = '<egui:intnl text="admin.manager.is reserved word"/>';
		var dot = '<egui:intnl text="admin.manager.Manager ID/Nickname should not start or end with a dot"/>';
		var dotdot = "<egui:intnl text='admin.manager.Cannot have \'.\' in consecutive positions'/>";
		var alert_hostname = '<egui:intnl text="admin.manager.Please enter the Hostname/IP address of the host"/>';
		var alert_port1 = '<egui:intnl text="admin.manager.Please enter the port number"/>';
		var alert_port2 = '<egui:intnl text="admin.manager.Port number should be positive integer between "/> 1 to 65535';
		var alert_port3 = '<egui:intnl text="admin.manager.Invalid port number"/>';
		var _checkInt = '<egui:intnl text="admin.manager.Only valid integers are allowed"/>';
		var _checkspecial="Special characters are not allowed";
		var _checkfordecimal="Only whole numbers are allowed";
		var _checkAlpha="Alphabets are not allowed";
		var _checkIp="Cannot have '.' in consecutive positions";
		var _valIp="Invalid IP address. Please check the entries properly";
		var _validateIp="IP address should not start or end with a dot";
		var _checkspaceIp="Space not allowed in IP address";
		var _checkspecial="Special Characters not allowed";
		var _checknum="Number between '.' should be between 0 and 255";
		var addManager = '<egui:intnl text="admin.manager.Manager added successfully"/>';
		var updateManager = '<egui:intnl text="admin.manager.Manager updated successfully"/>';
		var deleteManager = '<egui:intnl text="admin.manager.Manager deleted successfully"/>';
		var deleteManagers = '<egui:intnl text="admin.manager.Managers deleted successfully"/>';
		var addExceptionMessage = '<egui:intnl text="admin.error.Exception occured while adding manager information"/>';
		var modifyExceptionMessage = '<egui:intnl text="admin.error.Exception occured while updating manager information"/>';
		var pleaseWait = '<egui:intnl text="admin.common.Updating"/>'+'...';
		var LoadAlert1 = '<table border="0" width="100%" height="100px" id="managedMgrId"><tr><td align="center" valign="middle"><div class="iconInformation"></div><div class="commonErrorMsgText" id="noCompAlrtDiv">'+noManagersNicknames+'</div></td></tr></table>';
		var LoadAlert2 = '<table border="0" width="100%" height="100px" id="unmanagedMgrId"><tr><td align="center" valign="middle"><div class="iconInformation"></div><div class="commonErrorMsgText" id="noCompAlrtDiv">'+noUnmanagersNicknames+'</div></td></tr></table>';

		// labels used in this page
		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"/>';

		// variables used in controllers for audit log
		var previous_url = null;
		var previous_alturl = null;

		var publicJSON = '';

	</script>

	<!-- Application folder -->
	<script type="text/javascript" src="ManagersList/app/app.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>
</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>

<%
	session.setAttribute("adminLastAccessedURL","/final/admin/EgDispManagers.jsp?"+request.getQueryString());
%>


