<%@ include file = "EgTrackerA.jsp" %>
<%@ page import = "com.egurkha.ini.IniUI"%>
<%@ page import = "java.io.*"%>

<%@ taglib prefix = "egui" uri = "../WEB-INF/eg-taglib.tld" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="listSearchJson.jsp"%>
<%
	response.setHeader("Cache-Control","no-store");
	response.setHeader("Pragma","no-cache");
	response.setDateHeader("Expires", -1);

	IniUI iniUI = IniUI.getInstance();
	ArrayList dateFormats;

	//user language
	String userLanguage = iniUI.getDefaultLanguage();
	if (_user != null)
	{
		userLanguage = _user.getLanguage();
	}

	String fromWizard = request.getParameter("fromWizard");
	if(com.egurkha.util.StringUtils.isNull(fromWizard))
	{
		fromWizard = "";
	}
%>
<html>
<head>
<style>
	div.emptyText {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		height: 95%;
		flex-direction: column;
		display: flex;
		align-items: center;
		justify-content: center;
	}


</style>
<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 language="JavaScript1.2" src="../scripts/<%=script_src%>"></script>
<script language="javascript">
	var csrfToken = '<%=strCsrfToken%>';
	var fromWizard = '<%=fromWizard%>';
	var pageTitle = '<egui:intnl text="admin.title.View Users"/>';
	var homeTitle = '<div>'+pageTitle+' <img src="/final/images/spacer.gif" id="homeTitle" class="iconInfoCircle" style="vertical-align:text-top;position:relative;top:2px"/></div>';
	var backText = '<egui:intnl text="admin.header.Back"/>';
	var pageDiscription = '<egui:intnl description="EgViewUser.jsp"/>.';
	var publicJSON = '';
	var intnlLabel1 = '<egui:intnl text="admin.user.No users have been configured"/>';
	var searchLbl = '<egui:intnl text="admin.title.Search"/>';
	var noUserSearchAlert = '<egui:intnl text="admin.user.No user found for your current search"/>';
	var LoadSearchAlert = '<div class="egFlexCenterByColumnWise" style="height:100%"><div class="iconInformation"></div><div class="commonErrorMsgText" id="noCompAlrtDiv">'+noUserSearchAlert+'</div></div>';
	var allUsersLabel = '<egui:intnl text="admin.common.All user accounts"/>';
	var liveUsersLabel = '<egui:intnl text="admin.common.Active user accounts"/>';
	var expiredUsersLabel = '<egui:intnl text="admin.common.Expired user accounts"/>';
	var noUserAlert = '<egui:intnl text="admin.common.No user accounts found for the current category"/>';
	var LoadAlert = '<div class="egFlexCenterByColumnWise" style="height:100%"><div class="iconInformation"></div><div class="commonErrorMsgText" id="noCompAlrtDiv">'+noUserAlert+'</div></div>';

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

	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>
<egui:skin ui="admin"/>
<script src="../admin/EgViewUser/app/app.js"></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(com.egurkha.util.StringUtils.isNull(fromWizard))
	{
		String temp_qury=request.getQueryString();
		if(request.getQueryString()!=null)
		{
			session.setAttribute("adminLastAccessedURL","/final/admin/EgViewUser.jsp?"+request.getQueryString());
		}
		else
		{
			session.setAttribute("adminLastAccessedURL","/final/admin/EgViewUser.jsp?qctr=0");
		}
	}
%>



